Avoid error if CORE product data is missing some fields
This commit is contained in:
parent
e91fef0e8d
commit
1f3ab43e91
|
@ -2,7 +2,7 @@
|
|||
################################################################################
|
||||
#
|
||||
# Rattail -- Retail Software Framework
|
||||
# Copyright © 2010-2021 Lance Edgar
|
||||
# Copyright © 2010-2022 Lance Edgar
|
||||
#
|
||||
# This file is part of Rattail.
|
||||
#
|
||||
|
@ -574,8 +574,8 @@ class ProductImporter(FromCOREPOSAPI, corepos_importing.model.ProductImporter):
|
|||
'department_number': department_number,
|
||||
'subdepartment_number': subdepartment_number,
|
||||
|
||||
'weighed': product['scale'] == '1',
|
||||
'food_stampable': product['foodstamp'] == '1',
|
||||
'weighed': product.get('scale') == '1',
|
||||
'food_stampable': None,
|
||||
# 'tax1': product['tax'] == '1', # TODO: is this right?
|
||||
# 'tax2': product['tax'] == '2', # TODO: is this right?
|
||||
|
||||
|
@ -584,6 +584,9 @@ class ProductImporter(FromCOREPOSAPI, corepos_importing.model.ProductImporter):
|
|||
'regular_price_type': self.enum.PRICE_TYPE_REGULAR if price is not None else None,
|
||||
}
|
||||
|
||||
if 'foodstamp' in product:
|
||||
data['food_stampable'] = product['foodstamp'] == '1'
|
||||
|
||||
if self.fields_active(self.size_fields):
|
||||
size_info = self.normalize_size_info(product)
|
||||
data.update({
|
||||
|
|
Loading…
Reference in a new issue