From 6ec6b1c227d0cfd0dc448e174f1baa53aaca3fac 2021-09-25 17:19:21 From: Lance Edgar Date: 2021-09-25 17:19:21 Subject: [PATCH] Assign store, fix sequence when making a new custorder/batch --- diff --git a/rattail/batch/custorder.py b/rattail/batch/custorder.py index e54b2e64033c8ce87c9d6ccca43c55485d26a189..1556c9e16b27c881d2e1b28665ac3d019447a88b 100644 --- a/rattail/batch/custorder.py +++ b/rattail/batch/custorder.py @@ -53,6 +53,13 @@ class CustomerOrderBatchHandler(BatchHandler): has_custom_product_autocomplete = False nondigits_pattern = re.compile(r'\D') + def init_batch(self, batch, progress=None, **kwargs): + """ + Assign the "local" store to the batch, if applicable. + """ + session = self.app.get_session(batch) + batch.store = self.config.get_store(session) + def get_case_size_for_product(self, product): if product.case_size: return product.case_size @@ -232,7 +239,7 @@ class CustomerOrderBatchHandler(BatchHandler): def convert(row, i): item = model.CustomerOrderItem() - item.sequence = i + 1 + item.sequence = i item.status_code = self.enum.CUSTORDER_ITEM_STATUS_ORDERED for field in row_fields: setattr(item, field, getattr(row, field))