From 084e65a32de3d8fca6eed0da9f7f44bada1701f5 2021-08-29 16:36:36 From: Lance Edgar Date: 2021-08-29 16:36:36 Subject: [PATCH] Tweak some customization hooks for custorder batch handler --- diff --git a/rattail/batch/custorder.py b/rattail/batch/custorder.py index 7378c322c0fef98974f35a4fee9ccad3a59ce681..913ec47891592a76d2b74fc17c520e61aacf9773 100644 --- a/rattail/batch/custorder.py +++ b/rattail/batch/custorder.py @@ -42,6 +42,9 @@ class CustomerOrderBatchHandler(BatchHandler): """ batch_model_class = model.CustomerOrderBatch + def get_case_size_for_product(self, product): + return product.case_size + def refresh_row(self, row): if not row.product: if row.item_entry: @@ -60,7 +63,7 @@ class CustomerOrderBatchHandler(BatchHandler): row.product_description = product.description row.product_size = product.size row.product_weighed = product.weighed - row.case_quantity = product.case_size + row.case_quantity = self.get_case_size_for_product(product) department = product.department row.department_number = department.number if department else None diff --git a/rattail/batch/handlers.py b/rattail/batch/handlers.py index b11db66a59798cb20d61c821bc0b25944712b039..7e089be84a85d58a8ba472a9ea104c63c58e9679 100644 --- a/rattail/batch/handlers.py +++ b/rattail/batch/handlers.py @@ -557,7 +557,11 @@ class BatchHandler(object): if product: return product - product_key = self.config.product_key() + # prefer caller-provided key over configured key + product_key = kwargs.get('product_key') + if not product_key: + product_key = self.config.product_key() + if product_key == 'upc': if entry.isdigit():