Improve case/unit quantity validation for order worksheet
This commit is contained in:
parent
37de777b2a
commit
e8dfe92be3
|
@ -202,11 +202,15 @@ class OrderingBatchView(PurchasingBatchView):
|
||||||
if not cases_ordered or not cases_ordered.isdigit():
|
if not cases_ordered or not cases_ordered.isdigit():
|
||||||
return {'error': "Invalid value for cases ordered: {}".format(cases_ordered)}
|
return {'error': "Invalid value for cases ordered: {}".format(cases_ordered)}
|
||||||
cases_ordered = int(cases_ordered)
|
cases_ordered = int(cases_ordered)
|
||||||
|
if cases_ordered >= 100000: # TODO: really this depends on underlying column
|
||||||
|
return {'error': "Invalid value for cases ordered: {}".format(cases_ordered)}
|
||||||
|
|
||||||
units_ordered = self.request.POST.get('units_ordered', '0')
|
units_ordered = self.request.POST.get('units_ordered', '0')
|
||||||
if not units_ordered or not units_ordered.isdigit():
|
if not units_ordered or not units_ordered.isdigit():
|
||||||
return {'error': "Invalid value for units ordered: {}".format(units_ordered)}
|
return {'error': "Invalid value for units ordered: {}".format(units_ordered)}
|
||||||
units_ordered = int(units_ordered)
|
units_ordered = int(units_ordered)
|
||||||
|
if units_ordered >= 100000: # TODO: really this depends on underlying column
|
||||||
|
return {'error': "Invalid value for units ordered: {}".format(units_ordered)}
|
||||||
|
|
||||||
uuid = self.request.POST.get('product_uuid')
|
uuid = self.request.POST.get('product_uuid')
|
||||||
product = self.Session.query(model.Product).get(uuid) if uuid else None
|
product = self.Session.query(model.Product).get(uuid) if uuid else None
|
||||||
|
|
Loading…
Reference in a new issue