Add custdata importer for CORE Office -> Lane

to double-check sync issues
This commit is contained in:
Lance Edgar 2021-11-04 17:42:38 -05:00
parent affd8a6453
commit 7522dd14cb
2 changed files with 46 additions and 0 deletions

View file

@ -45,3 +45,8 @@ class DepartmentImporter(ToCore):
class ProductImporter(ToCore):
model_class = corepos.Product
key = 'id'
class CustDataImporter(ToCore):
model_class = corepos.CustData
key = 'id'

View file

@ -73,6 +73,7 @@ class FromCoreOfficeToCoreLane(FromCoreOfficeHandler, ToCoreLaneHandler):
importers = OrderedDict()
importers['Department'] = DepartmentImporter
importers['Product'] = ProductImporter
importers['CustData'] = CustDataImporter
return importers
@ -183,3 +184,43 @@ class ProductImporter(FromCore, corepos_importing.model.ProductImporter):
data = dict([(field, getattr(product, field))
for field in self.common_fields])
return data
class CustDataImporter(FromCore, corepos_importing.model.CustDataImporter):
host_model_class = coreoffice.CustData
# these fields are held in common, between Office and Lane tables
common_fields = [
'id',
'card_number',
'person_number',
'first_name',
'last_name',
'cash_back',
'balance',
'discount',
'member_discount_limit',
'charge_limit',
'charge_ok',
'write_checks',
'store_coupons',
'type',
'member_type_id',
'staff',
'ssi',
'purchases',
'number_of_checks',
'member_coupons',
'blue_line',
'shown',
'last_change',
]
@property
def supported_fields(self):
return self.common_fields
def normalize_host_object(self, custdata):
data = dict([(field, getattr(custdata, field))
for field in self.common_fields])
return data