Rename model for custdata to CustomerClassic

This commit is contained in:
Lance Edgar 2023-06-12 17:30:44 -05:00
parent a6541a2c32
commit 9c15952386
9 changed files with 27 additions and 27 deletions

View file

@ -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'

View file

@ -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 = [

View file

@ -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):

View file

@ -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):

View file

@ -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',

View file

@ -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'

View file

@ -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()

View file

@ -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)

View file

@ -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')