2
0
mirror of https://github.com/inventree/InvenTree.git synced 2025-04-30 20:46:47 +00:00

Update display of BOM table based on the configurable setting

This commit is contained in:
Oliver 2021-10-08 12:47:51 +11:00
parent 69d932e193
commit 77c6e5e57e

View File

@ -148,6 +148,13 @@ function loadBomTable(table, options) {
ordering: 'name', ordering: 'name',
}; };
// Do we show part pricing in the BOM table?
var show_pricing = global_settings.PART_SHOW_PRICE_IN_BOM;
if (!show_pricing) {
params.include_pricing = false;
}
if (options.part_detail) { if (options.part_detail) {
params.part_detail = true; params.part_detail = true;
} }
@ -282,32 +289,34 @@ function loadBomTable(table, options) {
} }
}); });
cols.push({ if (show_pricing) {
field: 'purchase_price_range', cols.push({
title: '{% trans "Purchase Price Range" %}', field: 'purchase_price_range',
searchable: false, title: '{% trans "Purchase Price Range" %}',
sortable: true, searchable: false,
}); sortable: true,
});
cols.push({ cols.push({
field: 'purchase_price_avg', field: 'purchase_price_avg',
title: '{% trans "Purchase Price Average" %}', title: '{% trans "Purchase Price Average" %}',
searchable: false, searchable: false,
sortable: true, sortable: true,
}); });
cols.push({ cols.push({
field: 'price_range', field: 'price_range',
title: '{% trans "Supplier Cost" %}', title: '{% trans "Supplier Cost" %}',
sortable: true, sortable: true,
formatter: function(value) { formatter: function(value) {
if (value) { if (value) {
return value; return value;
} else { } else {
return `<span class='warning-msg'>{% trans 'No supplier pricing available' %}</span>`; return `<span class='warning-msg'>{% trans 'No supplier pricing available' %}</span>`;
}
} }
} });
}); }
cols.push({ cols.push({
field: 'optional', field: 'optional',