Changeset - 7522dd14cbce
[Not reviewed]
0 2 0
Lance Edgar - 3 years ago 2021-11-04 17:42:38
lance@edbob.org
Add `custdata` importer for CORE Office -> Lane

to double-check sync issues
2 files changed with 46 insertions and 0 deletions:
0 comments (0 inline, 0 general) First comment
rattail_corepos/corepos/lane/importing/op/model.py
Show inline comments
 
@@ -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'
rattail_corepos/corepos/lane/importing/op/office.py
Show inline comments
 
@@ -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
0 comments (0 inline, 0 general) First comment
You need to be logged in to comment. Login now