2
0
mirror of https://github.com/inventree/InvenTree.git synced 2025-07-12 07:54:14 +00:00

Enforce 'notes' field for StockItem move

- Better error handling for StockItem.move
This commit is contained in:
Oliver Walters
2019-04-25 23:01:03 +10:00
parent 38fa89d1da
commit 757cd539b2
3 changed files with 34 additions and 13 deletions

View File

@ -153,6 +153,9 @@ class StockMove(APIView):
errors = []
if u'notes' not in data:
errors.append({'notes': 'Notes field must be supplied'})
for pid in part_list:
try:
part = StockItem.objects.get(pk=pid)
@ -164,7 +167,7 @@ class StockMove(APIView):
raise ValidationError(errors)
for part in parts:
part.move(location, request.user)
part.move(location, data.get('notes'), request.user)
return Response({'success': 'Moved {n} parts to {loc}'.format(
n=len(parts),