From 99efbd4c40fb59432118bbb732d287b56814809d Mon Sep 17 00:00:00 2001 From: Oliver Walters Date: Thu, 26 Mar 2020 14:46:40 +1100 Subject: [PATCH] If a part has no stock but is on order, display an "on-order" badge --- .../InvenTree/static/script/inventree/part.js | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/InvenTree/InvenTree/static/script/inventree/part.js b/InvenTree/InvenTree/static/script/inventree/part.js index 8ad934760b..c94c512d6f 100644 --- a/InvenTree/InvenTree/static/script/inventree/part.js +++ b/InvenTree/InvenTree/static/script/inventree/part.js @@ -182,17 +182,27 @@ function loadPartTable(table, url, options={}) { searchable: false, sortable: true, formatter: function(value, row, index, field) { + console.log("On order:", row.on_order); + + var html = ""; + var link = "stock"; + if (value) { if (row.units) { value += ' ' + row.units + ''; } - return renderLink(value, '/part/' + row.pk + '/stock/'); - } - else { - return "No Stock"; + html = value; + + } else if (row.on_order) { + value = "On Order : " + row.on_order + ""; + link = "orders"; + } else { + value ="No Stock"; } + + return renderLink(value, '/part/' + row.pk + "/" + link + "/"); } });