Fix bug when non-numeric entry given for mobile inventory "quick row"

This commit is contained in:
Lance Edgar 2018-10-03 15:54:28 -05:00
parent d50d3678ec
commit 7650064b64

View file

@ -491,7 +491,8 @@ class InventoryBatchView(BatchMasterView):
"""
batch = self.get_instance()
row = None
entry = self.request.GET.get('upc', '').strip()
raw_entry = self.request.GET.get('upc', '')
entry = raw_entry.strip()
entry = re.sub(r'\D', '', entry)
if entry:
@ -505,6 +506,10 @@ class InventoryBatchView(BatchMasterView):
self.request.session.flash("UPC has too many digits ({}): {}".format(len(entry), entry), 'error')
return self.redirect(self.get_action_url('view', batch, mobile=True))
else:
self.request.session.flash("Product not found: {}".format(raw_entry), 'error')
return self.redirect(self.get_action_url('view', batch, mobile=True))
self.Session.flush()
return self.redirect(self.mobile_row_route_url('view', uuid=row.batch_uuid, row_uuid=row.uuid))