Improve error handling for purchase batch

so error will display in browser when applicable
This commit is contained in:
Lance Edgar 2021-09-09 12:00:13 -05:00
parent 82e730c18e
commit 97bdc3f785

View file

@ -428,8 +428,11 @@ class OrderingBatchView(PurchasingBatchView):
self.handler.add_row(batch, row)
# update row quantities
self.handler.update_row_quantity(row, cases_ordered=cases_ordered,
units_ordered=units_ordered)
try:
self.handler.update_row_quantity(row, cases_ordered=cases_ordered,
units_ordered=units_ordered)
except Exception as error:
return {'error': six.text_type(error)}
else: # empty order quantities