mirror of
https://github.com/inventree/InvenTree
synced 2024-08-30 18:33:04 +00:00
Improved response message for stocktake
This commit is contained in:
parent
990808ec03
commit
1f8632c77c
@ -111,17 +111,22 @@ class StockStocktake(APIView):
|
|||||||
if 'notes' in request.data:
|
if 'notes' in request.data:
|
||||||
notes = request.data['notes']
|
notes = request.data['notes']
|
||||||
|
|
||||||
|
n = 0
|
||||||
|
|
||||||
for item in items:
|
for item in items:
|
||||||
quantity = int(item['quantity'])
|
quantity = int(item['quantity'])
|
||||||
|
|
||||||
if action == u'stocktake':
|
if action == u'stocktake':
|
||||||
item['item'].stocktake(quantity, request.user, notes=notes)
|
if item['item'].stocktake(quantity, request.user, notes=notes):
|
||||||
|
n += 1
|
||||||
elif action == u'remove':
|
elif action == u'remove':
|
||||||
item['item'].take_stock(quantity, request.user, notes=notes)
|
if item['item'].take_stock(quantity, request.user, notes=notes):
|
||||||
|
n += 1
|
||||||
elif action == u'add':
|
elif action == u'add':
|
||||||
item['item'].add_stock(quantity, request.user, notes=notes)
|
if item['item'].add_stock(quantity, request.user, notes=notes):
|
||||||
|
n += 1
|
||||||
|
|
||||||
return Response({'success': 'success'})
|
return Response({'success': 'Updated stock for {n} items'.format(n=n)})
|
||||||
|
|
||||||
|
|
||||||
class StockMove(APIView):
|
class StockMove(APIView):
|
||||||
|
Loading…
Reference in New Issue
Block a user