Make inventory batch handler responsible for finding row for product
This commit is contained in:
parent
069eac1cf6
commit
0e7835e2d9
|
@ -371,17 +371,9 @@ class InventoryBatchView(BatchMasterView):
|
||||||
|
|
||||||
return result
|
return result
|
||||||
|
|
||||||
|
# TODO: deprecate / remove
|
||||||
def find_row_for_product(self, batch, product):
|
def find_row_for_product(self, batch, product):
|
||||||
rows = self.Session.query(model.InventoryBatchRow)\
|
return self.handler.find_row_for_product(self.Session(), batch, product)
|
||||||
.filter(model.InventoryBatchRow.batch == batch)\
|
|
||||||
.filter(model.InventoryBatchRow.product == product)\
|
|
||||||
.filter(model.InventoryBatchRow.removed == False)\
|
|
||||||
.all()
|
|
||||||
if rows:
|
|
||||||
if len(rows) > 1:
|
|
||||||
log.error("inventory batch %s should aggregate products, but has %s rows for: %s",
|
|
||||||
batch.id_str, len(rows), product)
|
|
||||||
return rows[0]
|
|
||||||
|
|
||||||
def find_product(self, entry):
|
def find_product(self, entry):
|
||||||
upc = re.sub(r'\D', '', entry.strip())
|
upc = re.sub(r'\D', '', entry.strip())
|
||||||
|
|
Loading…
Reference in a new issue