From c330cfccb5011dd231bcb734e3c4fc6fba9625bf Mon Sep 17 00:00:00 2001 From: Lance Edgar Date: Wed, 8 Apr 2020 16:13:51 -0500 Subject: [PATCH] Use subdept. number and name for `pf1` field in Catapult export --- .../importing/db/exporters/catapult_inventory.py | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/rattail_corepos/corepos/importing/db/exporters/catapult_inventory.py b/rattail_corepos/corepos/importing/db/exporters/catapult_inventory.py index f3848ad..c2d39fc 100644 --- a/rattail_corepos/corepos/importing/db/exporters/catapult_inventory.py +++ b/rattail_corepos/corepos/importing/db/exporters/catapult_inventory.py @@ -128,6 +128,10 @@ class InventoryItemImporter(FromCore, catapult_importing.model.InventoryItemImpo 'corepos', 'exporting.catapult_inventory.warn_missing_department', default=True) + self.warn_empty_subdepartment = self.config.getbool( + 'corepos', 'exporting.catapult_inventory.warn_empty_subdepartment', + default=True) + self.warn_truncated_receipt_alias = self.config.getbool( 'corepos', 'exporting.catapult_inventory.warn_truncated_receipt_alias', default=True) @@ -367,6 +371,16 @@ class InventoryItemImporter(FromCore, catapult_importing.model.InventoryItemImpo else: supplier_unit = 'CS' + pf1 = None + if product.subdepartment: + if not product.subdepartment.number: + logger = log.warning if self.warn_empty_subdepartment else log.debug + logger("product %s has 'empty' subdepartment number: %s", + product.upc, product) + else: + pf1 = "{} {}".format(product.subdepartment.number, + product.subdepartment.name) + memo = None if product.user_info and product.user_info.long_text is not None: memo = str(product.user_info.long_text) @@ -439,7 +453,7 @@ class InventoryItemImporter(FromCore, catapult_importing.model.InventoryItemImpo # 'cs_pk_multiplier': None, # 'dsd': None, - 'pf1': product.subdepartment.number if product.subdepartment else None, + 'pf1': pf1, # TODO: are these needed? # 'pf2',