From d365d7cc44869f8d2effb62d7f9b909d3cda0374 Mon Sep 17 00:00:00 2001 From: Oliver Walters Date: Sun, 2 Jun 2019 12:15:44 +1000 Subject: [PATCH] remove from stock now works --- InvenTree/static/script/inventree/stock.js | 5 +---- InvenTree/stock/templates/stock/stock_adjust.html | 2 +- InvenTree/stock/views.py | 4 +++- 3 files changed, 5 insertions(+), 6 deletions(-) diff --git a/InvenTree/static/script/inventree/stock.js b/InvenTree/static/script/inventree/stock.js index 4ddcba214e..0f2ee43136 100644 --- a/InvenTree/static/script/inventree/stock.js +++ b/InvenTree/static/script/inventree/stock.js @@ -571,10 +571,7 @@ function loadStockTable(table, options) { }); $('#multi-item-remove').click(function() { - updateStockItems({ - action: 'remove', - }); - return false; + stockAdjustment('take'); }); $('#multi-item-add').click(function() { diff --git a/InvenTree/stock/templates/stock/stock_adjust.html b/InvenTree/stock/templates/stock/stock_adjust.html index 0e6e2c4697..9bd4203725 100644 --- a/InvenTree/stock/templates/stock/stock_adjust.html +++ b/InvenTree/stock/templates/stock/stock_adjust.html @@ -23,7 +23,7 @@ {% if item.error %}
{{ item.error }} diff --git a/InvenTree/stock/views.py b/InvenTree/stock/views.py index 2c83545843..a5662e8d6e 100644 --- a/InvenTree/stock/views.py +++ b/InvenTree/stock/views.py @@ -277,7 +277,7 @@ class StockAdjust(AjaxView, FormMixin): valid = False continue - if self.stock_action in ['move']: + if self.stock_action in ['move', 'take']: if item.new_quantity > item.quantity: item.error = _('Quantity must not exceed {x}'.format(x=item.quantity)) @@ -351,6 +351,8 @@ class StockAdjust(AjaxView, FormMixin): if item.new_quantity <= 0: continue + item.take_stock(item.new_quantity, self.request.user, notes=note) + count += 1 return _("Removed stock from {n} items".format(n=count))