From fcbba9608ca3244951db2996733e36aaf5ea0527 Mon Sep 17 00:00:00 2001 From: Lance Edgar Date: Tue, 31 Mar 2020 23:26:37 -0500 Subject: [PATCH] Remove null characters from product size field, during export --- .../corepos/importing/db/exporters/catapult_inventory.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/rattail_corepos/corepos/importing/db/exporters/catapult_inventory.py b/rattail_corepos/corepos/importing/db/exporters/catapult_inventory.py index 3965c42..f8a19ea 100644 --- a/rattail_corepos/corepos/importing/db/exporters/catapult_inventory.py +++ b/rattail_corepos/corepos/importing/db/exporters/catapult_inventory.py @@ -216,6 +216,12 @@ class InventoryItemImporter(FromCore, catapult_importing.model.InventoryItemImpo logger("product %s has no department: %s", product.upc, product) 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 if (product.quantity and product.group_price and product.price_method == corepos_enum.PRODUCT_PRICE_METHOD_ALWAYS): @@ -374,7 +380,7 @@ class InventoryItemImporter(FromCore, catapult_importing.model.InventoryItemImpo 'receipt_alias': product.description, 'brand': product.brand, 'item_name': product.description, - 'size': product.size, + 'size': size, # TODO: does CORE have this? # 'sugg_retail': None,