Remove null characters from product size field, during export

This commit is contained in:
Lance Edgar 2020-03-31 23:26:37 -05:00
parent 4a03a7f57d
commit fcbba9608c

View file

@ -216,6 +216,12 @@ class InventoryItemImporter(FromCore, catapult_importing.model.InventoryItemImpo
logger("product %s has no department: %s", product.upc, product) logger("product %s has no department: %s", product.upc, product)
return return
size = product.size
# TODO: this logic may actually be client-specific? i just happened to
# find some of these chars in a client DB and needed to avoid them, b/c
# the openpyxl lib said IllegalCharacterError
size = size.replace('\x00', '')
price_divider = None price_divider = None
if (product.quantity and product.group_price and if (product.quantity and product.group_price and
product.price_method == corepos_enum.PRODUCT_PRICE_METHOD_ALWAYS): product.price_method == corepos_enum.PRODUCT_PRICE_METHOD_ALWAYS):
@ -374,7 +380,7 @@ class InventoryItemImporter(FromCore, catapult_importing.model.InventoryItemImpo
'receipt_alias': product.description, 'receipt_alias': product.description,
'brand': product.brand, 'brand': product.brand,
'item_name': product.description, 'item_name': product.description,
'size': product.size, 'size': size,
# TODO: does CORE have this? # TODO: does CORE have this?
# 'sugg_retail': None, # 'sugg_retail': None,