diff --git a/rattail_corepos/corepos/lane/importing/op/model.py b/rattail_corepos/corepos/lane/importing/op/model.py index dbb48f0..dfbe5fa 100644 --- a/rattail_corepos/corepos/lane/importing/op/model.py +++ b/rattail_corepos/corepos/lane/importing/op/model.py @@ -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' diff --git a/rattail_corepos/corepos/lane/importing/op/office.py b/rattail_corepos/corepos/lane/importing/op/office.py index 2071ca4..5d31d03 100644 --- a/rattail_corepos/corepos/lane/importing/op/office.py +++ b/rattail_corepos/corepos/lane/importing/op/office.py @@ -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