From 77c6e5e57ebd62330e56a2c8c2dcddb97677a694 Mon Sep 17 00:00:00 2001 From: Oliver Date: Fri, 8 Oct 2021 12:47:51 +1100 Subject: [PATCH] Update display of BOM table based on the configurable setting --- InvenTree/templates/js/translated/bom.js | 55 ++++++++++++++---------- 1 file changed, 32 insertions(+), 23 deletions(-) diff --git a/InvenTree/templates/js/translated/bom.js b/InvenTree/templates/js/translated/bom.js index 8f571df02e..ec37f71d15 100644 --- a/InvenTree/templates/js/translated/bom.js +++ b/InvenTree/templates/js/translated/bom.js @@ -148,6 +148,13 @@ function loadBomTable(table, options) { 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) { params.part_detail = true; } @@ -282,32 +289,34 @@ function loadBomTable(table, options) { } }); - cols.push({ - field: 'purchase_price_range', - title: '{% trans "Purchase Price Range" %}', - searchable: false, - sortable: true, - }); + if (show_pricing) { + cols.push({ + field: 'purchase_price_range', + title: '{% trans "Purchase Price Range" %}', + searchable: false, + sortable: true, + }); - cols.push({ - field: 'purchase_price_avg', - title: '{% trans "Purchase Price Average" %}', - searchable: false, - sortable: true, - }); + cols.push({ + field: 'purchase_price_avg', + title: '{% trans "Purchase Price Average" %}', + searchable: false, + sortable: true, + }); - cols.push({ - field: 'price_range', - title: '{% trans "Supplier Cost" %}', - sortable: true, - formatter: function(value) { - if (value) { - return value; - } else { - return `{% trans 'No supplier pricing available' %}`; + cols.push({ + field: 'price_range', + title: '{% trans "Supplier Cost" %}', + sortable: true, + formatter: function(value) { + if (value) { + return value; + } else { + return `{% trans 'No supplier pricing available' %}`; + } } - } - }); + }); + } cols.push({ field: 'optional',