Add custdata
importer for CORE Office -> Lane
to double-check sync issues
This commit is contained in:
parent
affd8a6453
commit
7522dd14cb
|
@ -45,3 +45,8 @@ class DepartmentImporter(ToCore):
|
||||||
class ProductImporter(ToCore):
|
class ProductImporter(ToCore):
|
||||||
model_class = corepos.Product
|
model_class = corepos.Product
|
||||||
key = 'id'
|
key = 'id'
|
||||||
|
|
||||||
|
|
||||||
|
class CustDataImporter(ToCore):
|
||||||
|
model_class = corepos.CustData
|
||||||
|
key = 'id'
|
||||||
|
|
|
@ -73,6 +73,7 @@ class FromCoreOfficeToCoreLane(FromCoreOfficeHandler, ToCoreLaneHandler):
|
||||||
importers = OrderedDict()
|
importers = OrderedDict()
|
||||||
importers['Department'] = DepartmentImporter
|
importers['Department'] = DepartmentImporter
|
||||||
importers['Product'] = ProductImporter
|
importers['Product'] = ProductImporter
|
||||||
|
importers['CustData'] = CustDataImporter
|
||||||
return importers
|
return importers
|
||||||
|
|
||||||
|
|
||||||
|
@ -183,3 +184,43 @@ class ProductImporter(FromCore, corepos_importing.model.ProductImporter):
|
||||||
data = dict([(field, getattr(product, field))
|
data = dict([(field, getattr(product, field))
|
||||||
for field in self.common_fields])
|
for field in self.common_fields])
|
||||||
return data
|
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
|
||||||
|
|
Loading…
Reference in a new issue