From 2ea4824030b689e5e5606becea41af5d11d27ee8 Mon Sep 17 00:00:00 2001 From: Oliver Date: Mon, 12 Jul 2021 20:45:45 +1000 Subject: [PATCH] Add option to move stock for a part --- InvenTree/part/templates/part/part_base.html | 34 ++++++++++++++++--- InvenTree/stock/templates/stock/location.html | 14 +++++--- 2 files changed, 39 insertions(+), 9 deletions(-) diff --git a/InvenTree/part/templates/part/part_base.html b/InvenTree/part/templates/part/part_base.html index 413f761cb9..8e1b60b31b 100644 --- a/InvenTree/part/templates/part/part_base.html +++ b/InvenTree/part/templates/part/part_base.html @@ -49,9 +49,25 @@ {% if roles.stock.change %} - + {% endif %} {% if part.purchaseable %} {% if roles.purchase_order.add %} @@ -272,7 +288,7 @@ printPartLabels([{{ part.pk }}]); }); - $("#part-count").click(function() { + function adjustPartStock(action) { inventreeGet( '{% url "api-stock-list" %}', { @@ -284,7 +300,7 @@ }, { success: function(items) { - adjustStock('count', items, { + adjustStock(action, items, { onSuccess: function() { location.reload(); } @@ -292,6 +308,14 @@ }, } ); + } + + $("#part-move").click(function() { + adjustPartStock('move'); + }); + + $("#part-count").click(function() { + adjustPartStock('count'); }); $("#price-button").click(function() { diff --git a/InvenTree/stock/templates/stock/location.html b/InvenTree/stock/templates/stock/location.html index 889e7a2c98..8230de473c 100644 --- a/InvenTree/stock/templates/stock/location.html +++ b/InvenTree/stock/templates/stock/location.html @@ -59,11 +59,17 @@ {% if owner_control.value == "False" or owner_control.value == "True" and user in owners or user.is_superuser %} {% if roles.stock.change %} {% endif %} {% if roles.stock_location.change %}