Allow suppression of logging for unknown bottle deposits

This commit is contained in:
Lance Edgar 2020-04-09 10:39:30 -05:00
parent aefaaf8351
commit 7e450e11b1

View file

@ -141,6 +141,10 @@ class InventoryItemImporter(FromCore, catapult_importing.model.InventoryItemImpo
'corepos', 'exporting.catapult_inventory.warn_size_null_byte', 'corepos', 'exporting.catapult_inventory.warn_size_null_byte',
default=True) 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( self.warn_multiple_vendor_items = self.config.getbool(
'corepos', 'exporting.catapult_inventory.warn_multiple_vendor_items', 'corepos', 'exporting.catapult_inventory.warn_multiple_vendor_items',
default=True) default=True)
@ -277,7 +281,8 @@ class InventoryItemImporter(FromCore, catapult_importing.model.InventoryItemImpo
if deposit in self.deposits: if deposit in self.deposits:
bottle_deposit = self.deposits[deposit].normal_price bottle_deposit = self.deposits[deposit].normal_price
else: else:
log.warning("product %s has unknown deposit %s which will be ignored: %s", 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) product.upc, deposit, product)
sold_by_ea_or_lb = None sold_by_ea_or_lb = None