From 5e5bced0c7da13c8b35c1ef8730604c67f4d5729 Mon Sep 17 00:00:00 2001 From: Oliver Walters Date: Thu, 28 Jan 2021 21:51:34 +1100 Subject: [PATCH] Optionally include javascript code based on barcode feature --- InvenTree/templates/js/stock.js | 5 +++++ InvenTree/templates/stock_table.html | 3 ++- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/InvenTree/templates/js/stock.js b/InvenTree/templates/js/stock.js index f1926e9c31..b156fbc271 100644 --- a/InvenTree/templates/js/stock.js +++ b/InvenTree/templates/js/stock.js @@ -6,6 +6,7 @@ * Requires api.js to be loaded first */ +{% settings_value 'BARCODE_ENABLE' as barcodes %} function stockStatusCodes() { return [ @@ -635,7 +636,9 @@ function loadStockTable(table, options) { table, [ '#stock-print-options', + {% if barcodes %} '#stock-barcode-options', + {% endif %} '#stock-options', ] ); @@ -701,6 +704,7 @@ function loadStockTable(table, options) { printTestReports(items); }) + {% if barcodes %} $('#multi-item-barcode-scan-into-location').click(function() { var selections = $('#stock-table').bootstrapTable('getSelections'); @@ -712,6 +716,7 @@ function loadStockTable(table, options) { scanItemsIntoLocation(items); }); + {% endif %} $('#multi-item-stocktake').click(function() { stockAdjustment('count'); diff --git a/InvenTree/templates/stock_table.html b/InvenTree/templates/stock_table.html index b5b61d1ed3..4caf2f59fd 100644 --- a/InvenTree/templates/stock_table.html +++ b/InvenTree/templates/stock_table.html @@ -1,6 +1,8 @@ {% load i18n %} {% load inventree_extras %} +{% settings_value 'BARCODE_ENABLE' as barcodes %} + {% setting_object 'STOCK_OWNERSHIP_CONTROL' as owner_control %} {% if owner_control.value == "True" %} {% authorized_owners location.owner as owners %} @@ -19,7 +21,6 @@ {% endif %} - {% settings_value 'BARCODE_ENABLE' as barcodes %} {% if barcodes %}