From 9c1595238668083bc720c82a7792d98c318d0305 Mon Sep 17 00:00:00 2001 From: Lance Edgar Date: Mon, 12 Jun 2023 17:30:44 -0500 Subject: [PATCH] Rename model for `custdata` to `CustomerClassic` --- .../corepos/lane/importing/op/model.py | 6 +++--- .../corepos/lane/importing/op/office.py | 6 +++--- .../corepos/office/importing/db/corepos.py | 4 ++-- .../db/exporters/catapult_membership.py | 16 ++++++++-------- .../corepos/office/importing/db/local.py | 6 +++--- .../corepos/office/importing/db/model.py | 4 ++-- rattail_corepos/corepos/util.py | 4 ++-- rattail_corepos/emails.py | 2 +- rattail_corepos/trainwreck/importing/corepos.py | 6 +++--- 9 files changed, 27 insertions(+), 27 deletions(-) diff --git a/rattail_corepos/corepos/lane/importing/op/model.py b/rattail_corepos/corepos/lane/importing/op/model.py index dfbe5fa..fc5b325 100644 --- a/rattail_corepos/corepos/lane/importing/op/model.py +++ b/rattail_corepos/corepos/lane/importing/op/model.py @@ -2,7 +2,7 @@ ################################################################################ # # Rattail -- Retail Software Framework -# Copyright © 2010-2021 Lance Edgar +# Copyright © 2010-2023 Lance Edgar # # This file is part of Rattail. # @@ -47,6 +47,6 @@ class ProductImporter(ToCore): key = 'id' -class CustDataImporter(ToCore): - model_class = corepos.CustData +class CustomerClassicImporter(ToCore): + model_class = corepos.CustomerClassic key = 'id' diff --git a/rattail_corepos/corepos/lane/importing/op/office.py b/rattail_corepos/corepos/lane/importing/op/office.py index 572cee3..80a8eab 100644 --- a/rattail_corepos/corepos/lane/importing/op/office.py +++ b/rattail_corepos/corepos/lane/importing/op/office.py @@ -78,7 +78,7 @@ class FromCoreOfficeToCoreLane(FromCoreOfficeHandler, ToCoreLaneHandler): importers = OrderedDict() importers['Department'] = DepartmentImporter importers['Product'] = ProductImporter - importers['CustData'] = CustDataImporter + importers['CustomerClassic'] = CustomerClassicImporter return importers @@ -191,8 +191,8 @@ class ProductImporter(FromCore, corepos_importing.model.ProductImporter): return data -class CustDataImporter(FromCore, corepos_importing.model.CustDataImporter): - host_model_class = coreoffice.CustData +class CustomerClassicImporter(FromCore, corepos_importing.model.CustomerClassicImporter): + host_model_class = coreoffice.CustomerClassic # these fields are held in common, between Office and Lane tables common_fields = [ diff --git a/rattail_corepos/corepos/office/importing/db/corepos.py b/rattail_corepos/corepos/office/importing/db/corepos.py index 08aa231..440a810 100644 --- a/rattail_corepos/corepos/office/importing/db/corepos.py +++ b/rattail_corepos/corepos/office/importing/db/corepos.py @@ -63,7 +63,7 @@ class FromCoreToCoreBase(object): importers['ProductFlag'] = ProductFlagImporter importers['VendorItem'] = VendorItemImporter importers['Employee'] = EmployeeImporter - importers['CustData'] = CustDataImporter + importers['CustomerClassic'] = CustomerClassicImporter importers['MemberType'] = MemberTypeImporter importers['MemberInfo'] = MemberInfoImporter importers['HouseCoupon'] = HouseCouponImporter @@ -140,7 +140,7 @@ class VendorItemImporter(FromCore, corepos_importing.model.VendorItemImporter): class EmployeeImporter(FromCore, corepos_importing.model.EmployeeImporter): pass -class CustDataImporter(FromCore, corepos_importing.model.CustDataImporter): +class CustomerClassicImporter(FromCore, corepos_importing.model.CustomerClassicImporter): pass class MemberTypeImporter(FromCore, corepos_importing.model.MemberTypeImporter): diff --git a/rattail_corepos/corepos/office/importing/db/exporters/catapult_membership.py b/rattail_corepos/corepos/office/importing/db/exporters/catapult_membership.py index 153cb69..2cb7ed1 100644 --- a/rattail_corepos/corepos/office/importing/db/exporters/catapult_membership.py +++ b/rattail_corepos/corepos/office/importing/db/exporters/catapult_membership.py @@ -60,7 +60,7 @@ class MemberImporter(FromCore, catapult_importing.model.MemberImporter): """ Member data importer. """ - host_model_class = corepos.CustData + host_model_class = corepos.CustomerClassic supported_fields = [ 'member_id', 'first_name', @@ -108,14 +108,14 @@ class MemberImporter(FromCore, catapult_importing.model.MemberImporter): raise RuntimeError("cannot determine default membership profile") def query(self): - return self.host_session.query(corepos.CustData)\ - .order_by(corepos.CustData.card_number, - corepos.CustData.person_number, - corepos.CustData.id)\ - .options(orm.joinedload(corepos.CustData.member_type))\ - .options(orm.joinedload(corepos.CustData.member_info)\ + return self.host_session.query(corepos.CustomerClassic)\ + .order_by(corepos.CustomerClassic.card_number, + corepos.CustomerClassic.person_number, + corepos.CustomerClassic.id)\ + .options(orm.joinedload(corepos.CustomerClassic.member_type))\ + .options(orm.joinedload(corepos.CustomerClassic.member_info)\ .joinedload(corepos.MemberInfo.dates))\ - .options(orm.joinedload(corepos.CustData.member_info)\ + .options(orm.joinedload(corepos.CustomerClassic.member_info)\ .joinedload(corepos.MemberInfo.notes)) def normalize_host_object(self, custdata): diff --git a/rattail_corepos/corepos/office/importing/db/local.py b/rattail_corepos/corepos/office/importing/db/local.py index cafff3d..ac0c6bb 100644 --- a/rattail_corepos/corepos/office/importing/db/local.py +++ b/rattail_corepos/corepos/office/importing/db/local.py @@ -57,7 +57,7 @@ class FromCoreOfficeToSelf(FromCoreHandler, corepos_importing.model.ToCoreHandle def get_importers(self): importers = OrderedDict() - importers['CustData'] = CustDataImporter + importers['CustomerClassic'] = CustomerClassicImporter return importers @@ -69,13 +69,13 @@ class FromCoreOffice(importing.FromSQLAlchemy): """ -class CustDataImporter(FromCoreOffice, corepos_importing.model.CustDataImporter): +class CustomerClassicImporter(FromCoreOffice, corepos_importing.model.CustomerClassicImporter): """ custdata -> custdata Primarily used to update the ``blueLine`` field. """ - host_model_class = corepos.CustData + host_model_class = corepos.CustomerClassic supported_fields = [ 'id', 'blue_line', diff --git a/rattail_corepos/corepos/office/importing/db/model.py b/rattail_corepos/corepos/office/importing/db/model.py index fd2dd55..6a2ae41 100644 --- a/rattail_corepos/corepos/office/importing/db/model.py +++ b/rattail_corepos/corepos/office/importing/db/model.py @@ -144,8 +144,8 @@ class EmployeeImporter(ToCore): key = 'number' -class CustDataImporter(ToCore): - model_class = corepos.CustData +class CustomerClassicImporter(ToCore): + model_class = corepos.CustomerClassic key = 'id' diff --git a/rattail_corepos/corepos/util.py b/rattail_corepos/corepos/util.py index 14762ad..68daed7 100644 --- a/rattail_corepos/corepos/util.py +++ b/rattail_corepos/corepos/util.py @@ -46,8 +46,8 @@ def get_core_members(config, api, progress=None): # first we fetch all customer records from CORE DB with app.short_session(factory=CoreSession) as s: - db_customers = s.query(corepos.CustData)\ - .order_by(corepos.CustData.card_number)\ + db_customers = s.query(corepos.CustomerClassic)\ + .order_by(corepos.CustomerClassic.card_number)\ .all() s.expunge_all() diff --git a/rattail_corepos/emails.py b/rattail_corepos/emails.py index 651ab69..66dd464 100644 --- a/rattail_corepos/emails.py +++ b/rattail_corepos/emails.py @@ -53,7 +53,7 @@ class corepos_problems_invalid_person_numbers(ProblemReportEmail): def sample_data(self, request): from corepos.db.office_op import model as corepos - customer = corepos.CustData(card_number=42, + customer = corepos.CustomerClassic(card_number=42, first_name="Fred", last_name="Flintstone", person_number=2) diff --git a/rattail_corepos/trainwreck/importing/corepos.py b/rattail_corepos/trainwreck/importing/corepos.py index ea80bac..752737e 100644 --- a/rattail_corepos/trainwreck/importing/corepos.py +++ b/rattail_corepos/trainwreck/importing/corepos.py @@ -140,9 +140,9 @@ class TransactionImporter(FromCore, trainwreck_importing.model.TransactionImport key='number') if 'customer_name' in self.fields: - query = self.core_op_session.query(corepos.CustData)\ - .filter(corepos.CustData.person_number == 1) - self.corepos_customers = self.cache_model(corepos.CustData, + query = self.core_op_session.query(corepos.CustomerClassic)\ + .filter(corepos.CustomerClassic.person_number == 1) + self.corepos_customers = self.cache_model(corepos.CustomerClassic, session=self.core_op_session, query=query, key='card_number')