mirror of
https://github.com/inventree/InvenTree
synced 2024-08-30 18:33:04 +00:00
Raise error if specified quantity is above available quantity
This commit is contained in:
parent
5329e3e56c
commit
11ee8e8369
@ -248,6 +248,11 @@ class StockRemove(StockAdjust):
|
||||
|
||||
for item in self.items:
|
||||
|
||||
if item['quantity'] > item['item'].quantity:
|
||||
raise ValidationError({
|
||||
item['item'].pk: [_('Specified quantity exceeds stock quantity')]
|
||||
})
|
||||
|
||||
if item['item'].take_stock(item['quantity'], request.user, notes=self.notes):
|
||||
n += 1
|
||||
|
||||
@ -276,6 +281,11 @@ class StockTransfer(StockAdjust):
|
||||
|
||||
for item in self.items:
|
||||
|
||||
if item['quantity'] > item['item'].quantity:
|
||||
raise ValidationError({
|
||||
item['item'].pk: [_('Specified quantity exceeds stock quantity')]
|
||||
})
|
||||
|
||||
# If quantity is not specified, move the entire stock
|
||||
if item['quantity'] in [0, None]:
|
||||
item['quantity'] = item['item'].quantity
|
||||
|
Loading…
Reference in New Issue
Block a user