From 1887463f7fd48e9b949c952a32c3b0779de89b36 Mon Sep 17 00:00:00 2001 From: Oliver Walters Date: Mon, 4 Nov 2019 21:55:48 +1100 Subject: [PATCH] Properly display 'notes' field in grouped rows for stock table --- .../static/script/inventree/stock.js | 22 +++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/InvenTree/InvenTree/static/script/inventree/stock.js b/InvenTree/InvenTree/static/script/inventree/stock.js index e4582e879e..44a5aeaff4 100644 --- a/InvenTree/InvenTree/static/script/inventree/stock.js +++ b/InvenTree/InvenTree/static/script/inventree/stock.js @@ -125,6 +125,28 @@ function loadStockTable(table, options) { // A single location! return renderLink(row.location__path, '/stock/location/' + row.location + '/') } + } else if (field == 'notes') { + var notes = []; + + data.forEach(function(item) { + var note = item.notes; + + if (!note || note == '') { + note = '-'; + } + + if (!notes.includes(note)) { + notes.push(note); + } + }); + + if (notes.length > 1) { + return '...'; + } else if (notes.length == 1) { + return notes[0] || '-'; + } else { + return '-'; + } } else { return '';