2
0
mirror of https://github.com/inventree/InvenTree.git synced 2025-04-29 12:06:44 +00:00

remove from stock now works

This commit is contained in:
Oliver Walters 2019-06-02 12:15:44 +10:00
parent 1b3ffada6d
commit d365d7cc44
3 changed files with 5 additions and 6 deletions

View File

@ -571,10 +571,7 @@ function loadStockTable(table, options) {
}); });
$('#multi-item-remove').click(function() { $('#multi-item-remove').click(function() {
updateStockItems({ stockAdjustment('take');
action: 'remove',
});
return false;
}); });
$('#multi-item-add').click(function() { $('#multi-item-add').click(function() {

View File

@ -23,7 +23,7 @@
<td> <td>
<input class='numberinput' <input class='numberinput'
min='0' min='0'
{% if stock_action == 'move' %} max='{{ item.quantity }}' {% endif %} {% if stock_action == 'take' or stock_action == 'move' %} max='{{ item.quantity }}' {% endif %}
value='{{ item.new_quantity }}' type='number' name='stock-id-{{ item.id }}' id='stock-id-{{ item.id }}'/> value='{{ item.new_quantity }}' type='number' name='stock-id-{{ item.id }}' id='stock-id-{{ item.id }}'/>
{% if item.error %} {% if item.error %}
<br><span class='help-inline'>{{ item.error }}</span> <br><span class='help-inline'>{{ item.error }}</span>

View File

@ -277,7 +277,7 @@ class StockAdjust(AjaxView, FormMixin):
valid = False valid = False
continue continue
if self.stock_action in ['move']: if self.stock_action in ['move', 'take']:
if item.new_quantity > item.quantity: if item.new_quantity > item.quantity:
item.error = _('Quantity must not exceed {x}'.format(x=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: if item.new_quantity <= 0:
continue continue
item.take_stock(item.new_quantity, self.request.user, notes=note)
count += 1 count += 1
return _("Removed stock from {n} items".format(n=count)) return _("Removed stock from {n} items".format(n=count))