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:
@ -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),
|
||||
|
Reference in New Issue
Block a user