From 66e1b180e43d1877548ad73f7d4494010c437aec Mon Sep 17 00:00:00 2001 From: Oliver Walters Date: Tue, 23 Feb 2021 13:42:59 +1100 Subject: [PATCH] Add option to stock table to disable grouping at run-time --- InvenTree/templates/js/stock.js | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/InvenTree/templates/js/stock.js b/InvenTree/templates/js/stock.js index f1794f3664..b115b8171c 100644 --- a/InvenTree/templates/js/stock.js +++ b/InvenTree/templates/js/stock.js @@ -319,6 +319,12 @@ function loadStockTable(table, options) { } } + var grouping = true; + + if ('grouping' in options) { + grouping = options.grouping; + } + table.inventreeTable({ method: 'get', formatNoMatches: function() { @@ -333,7 +339,7 @@ function loadStockTable(table, options) { {% settings_value 'STOCK_GROUP_BY_PART' as group_by_part %} {% if group_by_part %} groupByField: options.groupByField || 'part', - groupBy: true, + groupBy: grouping, groupByFormatter: function(field, id, data) { var row = data[0];