Add 'auto_discount' to Catapult export

This commit is contained in:
Lance Edgar 2020-03-30 12:53:12 -05:00
parent e3204993b1
commit d87c889d26

View file

@ -91,7 +91,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',
# 'auto_discount', 'auto_discount',
'supplier_unit_id', 'supplier_unit_id',
'supplier_id', 'supplier_id',
'unit', '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: # if tax_rate_ids_2 and rate.id in tax_rate_ids_2:
# tax_2 += rate.rate # tax_2 += rate.rate
# no alt item by default # no alt item (or auto discount) by default
alt_id = None alt_id = None
alt_receipt_alias = None alt_receipt_alias = None
alt_pkg_qty = None alt_pkg_qty = None
alt_pkg_price = None alt_pkg_price = None
auto_discount = None
# make an alt item, when main item has pack pricing (e.g. Zevia sodas) # 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 # 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_qty = product.quantity
alt_pkg_price = product.group_price 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 # no supplier info by default
supplier_unit_id = None supplier_unit_id = None
supplier_id = None supplier_id = None
@ -366,10 +370,7 @@ class InventoryItemImporter(FromCore, catapult_importing.model.InventoryItemImpo
'alt_receipt_alias': alt_receipt_alias, 'alt_receipt_alias': alt_receipt_alias,
'alt_pkg_qty': alt_pkg_qty, 'alt_pkg_qty': alt_pkg_qty,
'alt_pkg_price': alt_pkg_price, 'alt_pkg_price': alt_pkg_price,
'auto_discount': auto_discount,
# TODO: does CORE have this?
# 'auto_discount': None,
'supplier_unit_id': supplier_unit_id, 'supplier_unit_id': supplier_unit_id,
'supplier_id': supplier_id, 'supplier_id': supplier_id,
'unit': supplier_unit, 'unit': supplier_unit,