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',