Make sure we refresh batch status when adding a new row

b/c whether or not it has a product will affect batch status.

this also changes how we interpret UPC for unknown product, i.e. by default we
now assume it does *not* have a check digit and that we should calculate that.
probably just a matter of time before someone needs the opposite though..
This commit is contained in:
Lance Edgar 2018-08-02 16:58:38 -05:00
parent e0f7ba827f
commit a24076f0ce

View file

@ -742,6 +742,7 @@ class ReceivingBatchView(PurchasingBatchView):
row.product = other_row.product
self.handler.add_row(batch, row)
self.Session.flush()
self.handler.refresh_batch_status(batch)
return row
# try to locate product by uuid before other, more specific key
@ -751,6 +752,7 @@ class ReceivingBatchView(PurchasingBatchView):
row.product = product
self.handler.add_row(batch, row)
self.Session.flush()
self.handler.refresh_batch_status(batch)
return row
key = self.rattail_config.product_key()
@ -767,6 +769,7 @@ class ReceivingBatchView(PurchasingBatchView):
row.product = product
self.handler.add_row(batch, row)
self.Session.flush()
self.handler.refresh_batch_status(batch)
return row
# check for "bad" upc
@ -775,11 +778,16 @@ class ReceivingBatchView(PurchasingBatchView):
# product not in system, but presumably sane upc, so add to batch anyway
row = model.PurchaseBatchRow()
row.upc = provided # TODO: why not checked? how to know?
add_check_digit = True # TODO: make this dynamic, of course
if add_check_digit:
row.upc = checked
else:
row.upc = provided
row.item_id = entry
row.description = "(unknown product)"
self.handler.add_row(batch, row)
self.Session.flush()
self.handler.refresh_batch_status(batch)
return row
elif key == 'item_id':
@ -791,6 +799,7 @@ class ReceivingBatchView(PurchasingBatchView):
row.product = product
self.handler.add_row(batch, row)
self.Session.flush()
self.handler.refresh_batch_status(batch)
return row
# check for "too long" item_id
@ -803,6 +812,7 @@ class ReceivingBatchView(PurchasingBatchView):
row.description = "(unknown product)"
self.handler.add_row(batch, row)
self.Session.flush()
self.handler.refresh_batch_status(batch)
return row
else: