From 7e450e11b1646076163c690eb9d91fb633828b88 Mon Sep 17 00:00:00 2001 From: Lance Edgar Date: Thu, 9 Apr 2020 10:39:30 -0500 Subject: [PATCH] Allow suppression of logging for unknown bottle deposits --- .../corepos/importing/db/exporters/catapult_inventory.py | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/rattail_corepos/corepos/importing/db/exporters/catapult_inventory.py b/rattail_corepos/corepos/importing/db/exporters/catapult_inventory.py index 932d90c..cfca200 100644 --- a/rattail_corepos/corepos/importing/db/exporters/catapult_inventory.py +++ b/rattail_corepos/corepos/importing/db/exporters/catapult_inventory.py @@ -141,6 +141,10 @@ class InventoryItemImporter(FromCore, catapult_importing.model.InventoryItemImpo 'corepos', 'exporting.catapult_inventory.warn_size_null_byte', default=True) + self.warn_unknown_deposit = self.config.getbool( + 'corepos', 'exporting.catapult_inventory.warn_unknown_deposit', + default=True) + self.warn_multiple_vendor_items = self.config.getbool( 'corepos', 'exporting.catapult_inventory.warn_multiple_vendor_items', default=True) @@ -277,8 +281,9 @@ class InventoryItemImporter(FromCore, catapult_importing.model.InventoryItemImpo if deposit in self.deposits: bottle_deposit = self.deposits[deposit].normal_price else: - log.warning("product %s has unknown deposit %s which will be ignored: %s", - product.upc, deposit, product) + logger = log.warning if self.warn_unknown_deposit else log.debug + logger("product %s has unknown deposit %s which will be ignored: %s", + product.upc, deposit, product) sold_by_ea_or_lb = None if is_plu: