Add better UPC validation for mobile receiving
This commit is contained in:
parent
5b4718fac4
commit
44dec830e5
|
@ -255,12 +255,17 @@ class ReceivingBatchView(PurchasingBatchView):
|
||||||
else:
|
else:
|
||||||
|
|
||||||
# if product not even in system, add to batch anyway..
|
# if product not even in system, add to batch anyway..
|
||||||
row = model.PurchaseBatchRow()
|
# but only if it was a "sane" UPC
|
||||||
row.upc = provided # TODO: why not checked? how to know?
|
if len(upc) <= 14:
|
||||||
row.description = "(unknown product)"
|
row = model.PurchaseBatchRow()
|
||||||
batch.add_row(row)
|
row.upc = provided # TODO: why not checked? how to know?
|
||||||
self.handler.refresh_row(row)
|
row.description = "(unknown product)"
|
||||||
self.handler.refresh_batch_status(batch)
|
batch.add_row(row)
|
||||||
|
self.handler.refresh_row(row)
|
||||||
|
self.handler.refresh_batch_status(batch)
|
||||||
|
else:
|
||||||
|
self.request.session.flash("Invalid UPC: {}".format(upc), 'error')
|
||||||
|
return self.redirect(self.get_action_url('view', batch, mobile=True))
|
||||||
|
|
||||||
self.Session.flush()
|
self.Session.flush()
|
||||||
return self.redirect(self.mobile_row_route_url('view', uuid=row.batch_uuid, row_uuid=row.uuid))
|
return self.redirect(self.mobile_row_route_url('view', uuid=row.batch_uuid, row_uuid=row.uuid))
|
||||||
|
|
Loading…
Reference in a new issue