From d87c889d26ec71b258afc99d6179f19707341d73 Mon Sep 17 00:00:00 2001 From: Lance Edgar Date: Mon, 30 Mar 2020 12:53:12 -0500 Subject: [PATCH] Add 'auto_discount' to Catapult export --- .../importing/db/exporters/catapult_inventory.py | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/rattail_corepos/corepos/importing/db/exporters/catapult_inventory.py b/rattail_corepos/corepos/importing/db/exporters/catapult_inventory.py index e4c8c4b..ccabcc2 100644 --- a/rattail_corepos/corepos/importing/db/exporters/catapult_inventory.py +++ b/rattail_corepos/corepos/importing/db/exporters/catapult_inventory.py @@ -91,7 +91,7 @@ class InventoryItemImporter(FromCore, catapult_importing.model.InventoryItemImpo 'alt_receipt_alias', 'alt_pkg_qty', 'alt_pkg_price', - # 'auto_discount', + 'auto_discount', 'supplier_unit_id', 'supplier_id', 'unit', @@ -230,11 +230,12 @@ class InventoryItemImporter(FromCore, catapult_importing.model.InventoryItemImpo # if tax_rate_ids_2 and rate.id in tax_rate_ids_2: # tax_2 += rate.rate - # no alt item by default + # no alt item (or auto discount) by default alt_id = None alt_receipt_alias = None alt_pkg_qty = None alt_pkg_price = None + auto_discount = None # make an alt item, when main item has pack pricing (e.g. Zevia sodas) # note that in this case the main item_id and alt_id are the same @@ -254,6 +255,9 @@ class InventoryItemImporter(FromCore, catapult_importing.model.InventoryItemImpo alt_pkg_qty = product.quantity alt_pkg_price = product.group_price + # we also must declare an "auto discount" to get pack price + auto_discount = "{} @ ${:0.2f}".format(alt_pkg_qty, alt_pkg_price) + # no supplier info by default supplier_unit_id = None supplier_id = None @@ -366,10 +370,7 @@ class InventoryItemImporter(FromCore, catapult_importing.model.InventoryItemImpo 'alt_receipt_alias': alt_receipt_alias, 'alt_pkg_qty': alt_pkg_qty, 'alt_pkg_price': alt_pkg_price, - - # TODO: does CORE have this? - # 'auto_discount': None, - + 'auto_discount': auto_discount, 'supplier_unit_id': supplier_unit_id, 'supplier_id': supplier_id, 'unit': supplier_unit,