Add scale info fields to Catapult export
This commit is contained in:
parent
e30cbf374e
commit
c5e618d517
|
@ -76,7 +76,7 @@ class InventoryItemImporter(FromCore, catapult_importing.model.InventoryItemImpo
|
||||||
'ideal_margin',
|
'ideal_margin',
|
||||||
'bottle_deposit',
|
'bottle_deposit',
|
||||||
'pos_menu_group',
|
'pos_menu_group',
|
||||||
# 'scale_label',
|
'scale_label',
|
||||||
'sold_by_ea_or_lb',
|
'sold_by_ea_or_lb',
|
||||||
'quantity_required',
|
'quantity_required',
|
||||||
'weight_profile',
|
'weight_profile',
|
||||||
|
@ -107,9 +107,9 @@ class InventoryItemImporter(FromCore, catapult_importing.model.InventoryItemImpo
|
||||||
# 'pf7',
|
# 'pf7',
|
||||||
# 'pf8',
|
# 'pf8',
|
||||||
# 'memo',
|
# 'memo',
|
||||||
# 'scale_shelf_life',
|
'scale_shelf_life',
|
||||||
# 'scale_shelf_life_type',
|
'scale_shelf_life_type',
|
||||||
# 'scale_ingredient_text',
|
'scale_ingredient_text',
|
||||||
]
|
]
|
||||||
|
|
||||||
def setup(self):
|
def setup(self):
|
||||||
|
@ -141,7 +141,8 @@ class InventoryItemImporter(FromCore, catapult_importing.model.InventoryItemImpo
|
||||||
.options(orm.joinedload(corepos.Product.subdepartment))\
|
.options(orm.joinedload(corepos.Product.subdepartment))\
|
||||||
.options(orm.joinedload(corepos.Product.vendor_items)\
|
.options(orm.joinedload(corepos.Product.vendor_items)\
|
||||||
.joinedload(corepos.VendorItem.vendor))\
|
.joinedload(corepos.VendorItem.vendor))\
|
||||||
.options(orm.joinedload(corepos.Product.default_vendor))
|
.options(orm.joinedload(corepos.Product.default_vendor))\
|
||||||
|
.options(orm.joinedload(corepos.Product.scale_item))
|
||||||
return query
|
return query
|
||||||
|
|
||||||
def normalize_host_object(self, product):
|
def normalize_host_object(self, product):
|
||||||
|
@ -273,6 +274,15 @@ class InventoryItemImporter(FromCore, catapult_importing.model.InventoryItemImpo
|
||||||
logger("product %s has %s vendorItems but each is missing (valid) vendor: %s",
|
logger("product %s has %s vendorItems but each is missing (valid) vendor: %s",
|
||||||
product.upc, len(product.vendor_items), product)
|
product.upc, len(product.vendor_items), product)
|
||||||
|
|
||||||
|
scale_item = product.scale_item
|
||||||
|
scale_ingredient_text = None
|
||||||
|
if scale_item:
|
||||||
|
scale_ingredient_text = scale_item.text
|
||||||
|
if "\n" in scale_ingredient_text:
|
||||||
|
log.warning("must remove carriage returns for scale ingredients: %s",
|
||||||
|
scale_ingredient_text)
|
||||||
|
scale_ingredient_text = scale_ingredient_text.replace("\n", " ")
|
||||||
|
|
||||||
if vendor_items:
|
if vendor_items:
|
||||||
if len(vendor_items) > 1:
|
if len(vendor_items) > 1:
|
||||||
|
|
||||||
|
@ -324,10 +334,7 @@ class InventoryItemImporter(FromCore, catapult_importing.model.InventoryItemImpo
|
||||||
|
|
||||||
'bottle_deposit': product.deposit or None,
|
'bottle_deposit': product.deposit or None,
|
||||||
'pos_menu_group': product.subdepartment.name if product.subdepartment else None,
|
'pos_menu_group': product.subdepartment.name if product.subdepartment else None,
|
||||||
|
'scale_label': 'Y' if scale_item else None,
|
||||||
# TODO: does CORE have these?
|
|
||||||
# 'scale_label': None,
|
|
||||||
|
|
||||||
'sold_by_ea_or_lb': sold_by_ea_or_lb,
|
'sold_by_ea_or_lb': sold_by_ea_or_lb,
|
||||||
'quantity_required': 'Y' if product.quantity_enforced else None,
|
'quantity_required': 'Y' if product.quantity_enforced else None,
|
||||||
'weight_profile': weight_profile,
|
'weight_profile': weight_profile,
|
||||||
|
@ -369,9 +376,10 @@ class InventoryItemImporter(FromCore, catapult_importing.model.InventoryItemImpo
|
||||||
# 'pf7',
|
# 'pf7',
|
||||||
# 'pf8',
|
# 'pf8',
|
||||||
|
|
||||||
# TODO: does CORE have these?
|
# TODO: does CORE have this?
|
||||||
# 'memo': None,
|
# 'memo': None,
|
||||||
# 'scale_shelf_life',
|
|
||||||
# 'scale_shelf_life_type',
|
'scale_shelf_life': scale_item.shelf_life if scale_item else None,
|
||||||
# 'scale_ingredient_text',
|
'scale_shelf_life_type': 0 if scale_item else None,
|
||||||
|
'scale_ingredient_text': scale_ingredient_text,
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue