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

Refactor showApiError() function

This commit is contained in:
Oliver
2021-07-12 19:20:29 +10:00
parent 0c41cc7c77
commit e04828214a
5 changed files with 79 additions and 48 deletions

View File

@ -244,17 +244,17 @@ class StockTransfer(StockAdjust):
def post(self, request, *args, **kwargs):
self.get_items(request)
data = request.data
try:
location = StockLocation.objects.get(pk=data.get('location', None))
except (ValueError, StockLocation.DoesNotExist):
raise ValidationError({'location': 'Valid location must be specified'})
raise ValidationError({'location': [_('Valid location must be specified')]})
n = 0
self.get_items(request)
for item in self.items:
# If quantity is not specified, move the entire stock