From 6adfc91c5c774ca2285eed83f86c7c19df5130f6 Mon Sep 17 00:00:00 2001 From: Oliver Date: Wed, 24 Aug 2022 16:37:03 +1000 Subject: [PATCH] StockItem page template fix (#3601) - Allow damaged / quarantined items to be adjusted - Fix template rendering logic --- .../stock/templates/stock/item_base.html | 77 +++++++++---------- 1 file changed, 36 insertions(+), 41 deletions(-) diff --git a/InvenTree/stock/templates/stock/item_base.html b/InvenTree/stock/templates/stock/item_base.html index d58086fd84..db9c4417d5 100644 --- a/InvenTree/stock/templates/stock/item_base.html +++ b/InvenTree/stock/templates/stock/item_base.html @@ -75,24 +75,19 @@
{% endif %} @@ -618,37 +612,7 @@ $("#stock-convert").click(function() { }); {% endif %} -{% if item.in_stock %} -$("#stock-assign-to-customer").click(function() { - - inventreeGet('{% url "api-stock-detail" item.pk %}', {}, { - success: function(response) { - assignStockToCustomer( - [response], - { - success: function() { - location.reload(); - }, - } - ); - } - }); -}); - -$("#stock-move").click(function() { - itemAdjust("move"); -}); - -$("#stock-count").click(function() { - itemAdjust('count'); -}); - -$('#stock-remove').click(function() { - itemAdjust('take'); -}); - -{% else %} - +{% if item.customer %} $("#stock-return-from-customer").click(function() { constructForm('{% url "api-stock-item-return" item.pk %}', { @@ -666,6 +630,37 @@ $("#stock-return-from-customer").click(function() { }); }); +{% else %} +$("#stock-assign-to-customer").click(function() { + + inventreeGet('{% url "api-stock-detail" item.pk %}', {}, { + success: function(response) { + assignStockToCustomer( + [response], + { + success: function() { + location.reload(); + }, + } + ); + } + }); +}); +{% endif %} + +{% if item.can_adjust_location %} + +$("#stock-move").click(function() { + itemAdjust("move"); +}); + +$("#stock-count").click(function() { + itemAdjust('count'); +}); + +$('#stock-remove').click(function() { + itemAdjust('take'); +}); {% endif %}