Tweak CORE DB -> Rattail for Product, to match CORE API -> Rattail
This commit is contained in:
parent
36b8afb03b
commit
85c45ef57e
|
@ -42,7 +42,7 @@ class FromCOREPOSToRattail(importing.FromSQLAlchemyHandler, importing.ToRattailH
|
|||
|
||||
@property
|
||||
def host_title(self):
|
||||
return "CORE POS ({})".format(self.corepos_dbkey)
|
||||
return "CORE POS (DB/{})".format(self.corepos_dbkey)
|
||||
|
||||
def make_host_session(self):
|
||||
return CoreSession(bind=self.config.corepos_engines[self.corepos_dbkey])
|
||||
|
@ -158,7 +158,7 @@ class ProductImporter(FromCOREPOS, importing.model.ProductImporter):
|
|||
Importer for product data from CORE POS.
|
||||
"""
|
||||
host_model_class = corepos.Product
|
||||
key = 'upc'
|
||||
key = 'item_id'
|
||||
supported_fields = [
|
||||
'item_id',
|
||||
'upc',
|
||||
|
@ -172,7 +172,7 @@ class ProductImporter(FromCOREPOS, importing.model.ProductImporter):
|
|||
'regular_price_multiple',
|
||||
'regular_price_type',
|
||||
'food_stampable',
|
||||
'tax1',
|
||||
# 'tax1',
|
||||
]
|
||||
|
||||
def normalize_host_object(self, product):
|
||||
|
@ -189,23 +189,19 @@ class ProductImporter(FromCOREPOS, importing.model.ProductImporter):
|
|||
if product.normal_price is not None:
|
||||
price = decimal.Decimal('{:03f}'.format(product.normal_price))
|
||||
|
||||
size = (product.size or '').strip() or None
|
||||
if size == '0': # TODO: this is only for sake of CORE sample data...
|
||||
size = None
|
||||
|
||||
return {
|
||||
'item_id': product.upc,
|
||||
'upc': upc,
|
||||
'brand_name': (product.brand or '').strip() or None,
|
||||
'description': (product.description or '').strip(),
|
||||
'size': size,
|
||||
'size': (product.size or '').strip() or None,
|
||||
|
||||
'department_number': product.department_number or None,
|
||||
'subdepartment_number': product.subdepartment_number or None,
|
||||
|
||||
'weighed': bool(product.scale),
|
||||
'food_stampable': product.foodstamp,
|
||||
'tax1': bool(product.tax), # TODO: is this right?
|
||||
# 'tax1': bool(product.tax), # TODO: is this right?
|
||||
|
||||
'regular_price_price': price,
|
||||
'regular_price_multiple': 1 if price is not None else None,
|
||||
|
|
Loading…
Reference in a new issue