mirror of
https://github.com/inventree/InvenTree
synced 2024-08-30 18:33:04 +00:00
Successfully move multiple parts with partial quantities
This commit is contained in:
parent
306a981ca1
commit
97b9cac205
@ -186,34 +186,19 @@ class StockMove(APIView):
|
|||||||
except ValueError:
|
except ValueError:
|
||||||
# Ignore this one
|
# Ignore this one
|
||||||
continue
|
continue
|
||||||
|
|
||||||
print('stock:', stock_id)
|
|
||||||
print('quantity:', quantity)
|
|
||||||
|
|
||||||
"""
|
# Ignore a zero quantity movement
|
||||||
|
if quantity <= 0:
|
||||||
for pid in part_list:
|
continue
|
||||||
|
|
||||||
try:
|
try:
|
||||||
part = StockItem.objects.get(pk=pid)
|
stock = StockItem.objects.get(pk=stock_id)
|
||||||
parts.append(part)
|
|
||||||
except StockItem.DoesNotExist:
|
except StockItem.DoesNotExist:
|
||||||
errors.append({'part': 'Part {id} does not exist'.format(id=pid)})
|
continue
|
||||||
|
|
||||||
if len(errors) > 0:
|
stock.move(location, data.get('notes'), request.user, quantity=quantity)
|
||||||
raise ValidationError(errors)
|
|
||||||
|
|
||||||
n = 0
|
return Response({'success': 'Moved parts to {loc}'.format(
|
||||||
|
|
||||||
for part in parts:
|
|
||||||
if part.move(location, data.get('notes'), request.user):
|
|
||||||
n += 1
|
|
||||||
|
|
||||||
"""
|
|
||||||
|
|
||||||
n = 0
|
|
||||||
|
|
||||||
return Response({'success': 'Moved {n} parts to {loc}'.format(
|
|
||||||
n=n,
|
|
||||||
loc=str(location)
|
loc=str(location)
|
||||||
)})
|
)})
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user