Allow some warnings to be suppressed for Catapult inventory export
This commit is contained in:
parent
28f17ca31a
commit
74deef63ab
|
@ -132,6 +132,10 @@ class InventoryItemImporter(FromCore, catapult_importing.model.InventoryItemImpo
|
||||||
'corepos', 'exporting.catapult_inventory.warn_truncated_receipt_alias',
|
'corepos', 'exporting.catapult_inventory.warn_truncated_receipt_alias',
|
||||||
default=True)
|
default=True)
|
||||||
|
|
||||||
|
self.warn_size_null_byte = self.config.getbool(
|
||||||
|
'corepos', 'exporting.catapult_inventory.warn_size_null_byte',
|
||||||
|
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)
|
||||||
|
@ -144,6 +148,10 @@ class InventoryItemImporter(FromCore, catapult_importing.model.InventoryItemImpo
|
||||||
'corepos', 'exporting.catapult_inventory.warn_truncated_memo',
|
'corepos', 'exporting.catapult_inventory.warn_truncated_memo',
|
||||||
default=True)
|
default=True)
|
||||||
|
|
||||||
|
self.warn_scale_ingredients_newline = self.config.getbool(
|
||||||
|
'corepos', 'exporting.catapult_inventory.warn_scale_ingredients_newline',
|
||||||
|
default=True)
|
||||||
|
|
||||||
self.floor_sections_exist = table_exists(self.host_session,
|
self.floor_sections_exist = table_exists(self.host_session,
|
||||||
corepos.FloorSection)
|
corepos.FloorSection)
|
||||||
self.tax_components_exist = table_exists(self.host_session,
|
self.tax_components_exist = table_exists(self.host_session,
|
||||||
|
@ -221,8 +229,9 @@ class InventoryItemImporter(FromCore, catapult_importing.model.InventoryItemImpo
|
||||||
# find some of these chars in a client DB and needed to avoid them, b/c
|
# find some of these chars in a client DB and needed to avoid them, b/c
|
||||||
# the openpyxl lib said IllegalCharacterError
|
# the openpyxl lib said IllegalCharacterError
|
||||||
if size is not None and '\x00' in size:
|
if size is not None and '\x00' in size:
|
||||||
log.warning("product %s has null byte in size field: %s",
|
logger = log.warning if self.warn_size_null_byte else log.debug
|
||||||
product.upc, product)
|
logger("product %s has null byte in size field: %s",
|
||||||
|
product.upc, product)
|
||||||
size = size.replace('\x00', '')
|
size = size.replace('\x00', '')
|
||||||
|
|
||||||
price_divider = None
|
price_divider = None
|
||||||
|
@ -372,8 +381,9 @@ class InventoryItemImporter(FromCore, catapult_importing.model.InventoryItemImpo
|
||||||
if scale_item:
|
if scale_item:
|
||||||
scale_ingredient_text = scale_item.text
|
scale_ingredient_text = scale_item.text
|
||||||
if "\n" in scale_ingredient_text:
|
if "\n" in scale_ingredient_text:
|
||||||
log.warning("must remove carriage returns for scale ingredients: %s",
|
logger = log.warning if self.warn_scale_ingredients_newline else log.debug
|
||||||
scale_ingredient_text)
|
logger("must remove carriage returns for scale ingredients: %s",
|
||||||
|
scale_ingredient_text)
|
||||||
scale_ingredient_text = scale_ingredient_text.replace("\n", " ")
|
scale_ingredient_text = scale_ingredient_text.replace("\n", " ")
|
||||||
|
|
||||||
return {
|
return {
|
||||||
|
|
Loading…
Reference in a new issue