From 5cdf5a26700d3c9d2d3d289dbc9af0b92d1837d2 Mon Sep 17 00:00:00 2001 From: Oliver Date: Wed, 6 Oct 2021 20:16:59 +1100 Subject: [PATCH] Only include "in stocK" field if the sales order is pending --- InvenTree/templates/js/translated/order.js | 28 +++++++++++++--------- 1 file changed, 17 insertions(+), 11 deletions(-) diff --git a/InvenTree/templates/js/translated/order.js b/InvenTree/templates/js/translated/order.js index 870ac9150d..a595a61d7c 100644 --- a/InvenTree/templates/js/translated/order.js +++ b/InvenTree/templates/js/translated/order.js @@ -1455,13 +1455,21 @@ function loadSalesOrderLineItemTable(table, options={}) { return formatter.format(total); } }, - { - field: 'stock', - title: '{% trans "In Stock" %}', - formatter: function(value, row) { - return row.part_detail.stock; + ]; + + if (pending) { + columns.push( + { + field: 'stock', + title: '{% trans "In Stock" %}', + formatter: function(value, row) { + return row.part_detail.stock; + }, }, - }, + ); + } + + columns.push( { field: 'allocated', title: pending ? '{% trans "Allocated" %}' : '{% trans "Fulfilled" %}', @@ -1492,7 +1500,9 @@ function loadSalesOrderLineItemTable(table, options={}) { field: 'notes', title: '{% trans "Notes" %}', }, - // TODO: Re-introduce the "PO" field, once it is fixed + ); + + // TODO: Re-introduce the "PO" field, once it is fixed /* { field: 'po', @@ -1514,7 +1524,6 @@ function loadSalesOrderLineItemTable(table, options={}) { } }, */ - ]; if (pending) { columns.push({ @@ -1553,9 +1562,6 @@ function loadSalesOrderLineItemTable(table, options={}) { return html; } }); - } else { - // Remove the "in stock" column - delete columns['stock']; } function reloadTable() {