From 97bdc3f7852ba66ed39a42e269aaf8d9027c2625 Mon Sep 17 00:00:00 2001 From: Lance Edgar Date: Thu, 9 Sep 2021 12:00:13 -0500 Subject: [PATCH] Improve error handling for purchase batch so error will display in browser when applicable --- tailbone/views/purchasing/ordering.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/tailbone/views/purchasing/ordering.py b/tailbone/views/purchasing/ordering.py index e184fd3f..69e361ed 100644 --- a/tailbone/views/purchasing/ordering.py +++ b/tailbone/views/purchasing/ordering.py @@ -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