From 0e7835e2d9546c93c3c5ba4534a810d607491cee Mon Sep 17 00:00:00 2001 From: Lance Edgar Date: Sun, 29 Mar 2020 14:41:16 -0500 Subject: [PATCH] Make inventory batch handler responsible for finding row for product --- tailbone/views/batch/inventory.py | 12 ++---------- 1 file changed, 2 insertions(+), 10 deletions(-) diff --git a/tailbone/views/batch/inventory.py b/tailbone/views/batch/inventory.py index 30412eb9..91577277 100644 --- a/tailbone/views/batch/inventory.py +++ b/tailbone/views/batch/inventory.py @@ -371,17 +371,9 @@ class InventoryBatchView(BatchMasterView): return result + # TODO: deprecate / remove def find_row_for_product(self, batch, product): - rows = self.Session.query(model.InventoryBatchRow)\ - .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] + return self.handler.find_row_for_product(self.Session(), batch, product) def find_product(self, entry): upc = re.sub(r'\D', '', entry.strip())