Rename model for custdata
to CustomerClassic
This commit is contained in:
parent
a6541a2c32
commit
9c15952386
|
@ -2,7 +2,7 @@
|
||||||
################################################################################
|
################################################################################
|
||||||
#
|
#
|
||||||
# Rattail -- Retail Software Framework
|
# Rattail -- Retail Software Framework
|
||||||
# Copyright © 2010-2021 Lance Edgar
|
# Copyright © 2010-2023 Lance Edgar
|
||||||
#
|
#
|
||||||
# This file is part of Rattail.
|
# This file is part of Rattail.
|
||||||
#
|
#
|
||||||
|
@ -47,6 +47,6 @@ class ProductImporter(ToCore):
|
||||||
key = 'id'
|
key = 'id'
|
||||||
|
|
||||||
|
|
||||||
class CustDataImporter(ToCore):
|
class CustomerClassicImporter(ToCore):
|
||||||
model_class = corepos.CustData
|
model_class = corepos.CustomerClassic
|
||||||
key = 'id'
|
key = 'id'
|
||||||
|
|
|
@ -78,7 +78,7 @@ class FromCoreOfficeToCoreLane(FromCoreOfficeHandler, ToCoreLaneHandler):
|
||||||
importers = OrderedDict()
|
importers = OrderedDict()
|
||||||
importers['Department'] = DepartmentImporter
|
importers['Department'] = DepartmentImporter
|
||||||
importers['Product'] = ProductImporter
|
importers['Product'] = ProductImporter
|
||||||
importers['CustData'] = CustDataImporter
|
importers['CustomerClassic'] = CustomerClassicImporter
|
||||||
return importers
|
return importers
|
||||||
|
|
||||||
|
|
||||||
|
@ -191,8 +191,8 @@ class ProductImporter(FromCore, corepos_importing.model.ProductImporter):
|
||||||
return data
|
return data
|
||||||
|
|
||||||
|
|
||||||
class CustDataImporter(FromCore, corepos_importing.model.CustDataImporter):
|
class CustomerClassicImporter(FromCore, corepos_importing.model.CustomerClassicImporter):
|
||||||
host_model_class = coreoffice.CustData
|
host_model_class = coreoffice.CustomerClassic
|
||||||
|
|
||||||
# these fields are held in common, between Office and Lane tables
|
# these fields are held in common, between Office and Lane tables
|
||||||
common_fields = [
|
common_fields = [
|
||||||
|
|
|
@ -63,7 +63,7 @@ class FromCoreToCoreBase(object):
|
||||||
importers['ProductFlag'] = ProductFlagImporter
|
importers['ProductFlag'] = ProductFlagImporter
|
||||||
importers['VendorItem'] = VendorItemImporter
|
importers['VendorItem'] = VendorItemImporter
|
||||||
importers['Employee'] = EmployeeImporter
|
importers['Employee'] = EmployeeImporter
|
||||||
importers['CustData'] = CustDataImporter
|
importers['CustomerClassic'] = CustomerClassicImporter
|
||||||
importers['MemberType'] = MemberTypeImporter
|
importers['MemberType'] = MemberTypeImporter
|
||||||
importers['MemberInfo'] = MemberInfoImporter
|
importers['MemberInfo'] = MemberInfoImporter
|
||||||
importers['HouseCoupon'] = HouseCouponImporter
|
importers['HouseCoupon'] = HouseCouponImporter
|
||||||
|
@ -140,7 +140,7 @@ class VendorItemImporter(FromCore, corepos_importing.model.VendorItemImporter):
|
||||||
class EmployeeImporter(FromCore, corepos_importing.model.EmployeeImporter):
|
class EmployeeImporter(FromCore, corepos_importing.model.EmployeeImporter):
|
||||||
pass
|
pass
|
||||||
|
|
||||||
class CustDataImporter(FromCore, corepos_importing.model.CustDataImporter):
|
class CustomerClassicImporter(FromCore, corepos_importing.model.CustomerClassicImporter):
|
||||||
pass
|
pass
|
||||||
|
|
||||||
class MemberTypeImporter(FromCore, corepos_importing.model.MemberTypeImporter):
|
class MemberTypeImporter(FromCore, corepos_importing.model.MemberTypeImporter):
|
||||||
|
|
|
@ -60,7 +60,7 @@ class MemberImporter(FromCore, catapult_importing.model.MemberImporter):
|
||||||
"""
|
"""
|
||||||
Member data importer.
|
Member data importer.
|
||||||
"""
|
"""
|
||||||
host_model_class = corepos.CustData
|
host_model_class = corepos.CustomerClassic
|
||||||
supported_fields = [
|
supported_fields = [
|
||||||
'member_id',
|
'member_id',
|
||||||
'first_name',
|
'first_name',
|
||||||
|
@ -108,14 +108,14 @@ class MemberImporter(FromCore, catapult_importing.model.MemberImporter):
|
||||||
raise RuntimeError("cannot determine default membership profile")
|
raise RuntimeError("cannot determine default membership profile")
|
||||||
|
|
||||||
def query(self):
|
def query(self):
|
||||||
return self.host_session.query(corepos.CustData)\
|
return self.host_session.query(corepos.CustomerClassic)\
|
||||||
.order_by(corepos.CustData.card_number,
|
.order_by(corepos.CustomerClassic.card_number,
|
||||||
corepos.CustData.person_number,
|
corepos.CustomerClassic.person_number,
|
||||||
corepos.CustData.id)\
|
corepos.CustomerClassic.id)\
|
||||||
.options(orm.joinedload(corepos.CustData.member_type))\
|
.options(orm.joinedload(corepos.CustomerClassic.member_type))\
|
||||||
.options(orm.joinedload(corepos.CustData.member_info)\
|
.options(orm.joinedload(corepos.CustomerClassic.member_info)\
|
||||||
.joinedload(corepos.MemberInfo.dates))\
|
.joinedload(corepos.MemberInfo.dates))\
|
||||||
.options(orm.joinedload(corepos.CustData.member_info)\
|
.options(orm.joinedload(corepos.CustomerClassic.member_info)\
|
||||||
.joinedload(corepos.MemberInfo.notes))
|
.joinedload(corepos.MemberInfo.notes))
|
||||||
|
|
||||||
def normalize_host_object(self, custdata):
|
def normalize_host_object(self, custdata):
|
||||||
|
|
|
@ -57,7 +57,7 @@ class FromCoreOfficeToSelf(FromCoreHandler, corepos_importing.model.ToCoreHandle
|
||||||
|
|
||||||
def get_importers(self):
|
def get_importers(self):
|
||||||
importers = OrderedDict()
|
importers = OrderedDict()
|
||||||
importers['CustData'] = CustDataImporter
|
importers['CustomerClassic'] = CustomerClassicImporter
|
||||||
return importers
|
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
|
custdata -> custdata
|
||||||
|
|
||||||
Primarily used to update the ``blueLine`` field.
|
Primarily used to update the ``blueLine`` field.
|
||||||
"""
|
"""
|
||||||
host_model_class = corepos.CustData
|
host_model_class = corepos.CustomerClassic
|
||||||
supported_fields = [
|
supported_fields = [
|
||||||
'id',
|
'id',
|
||||||
'blue_line',
|
'blue_line',
|
||||||
|
|
|
@ -144,8 +144,8 @@ class EmployeeImporter(ToCore):
|
||||||
key = 'number'
|
key = 'number'
|
||||||
|
|
||||||
|
|
||||||
class CustDataImporter(ToCore):
|
class CustomerClassicImporter(ToCore):
|
||||||
model_class = corepos.CustData
|
model_class = corepos.CustomerClassic
|
||||||
key = 'id'
|
key = 'id'
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -46,8 +46,8 @@ def get_core_members(config, api, progress=None):
|
||||||
|
|
||||||
# first we fetch all customer records from CORE DB
|
# first we fetch all customer records from CORE DB
|
||||||
with app.short_session(factory=CoreSession) as s:
|
with app.short_session(factory=CoreSession) as s:
|
||||||
db_customers = s.query(corepos.CustData)\
|
db_customers = s.query(corepos.CustomerClassic)\
|
||||||
.order_by(corepos.CustData.card_number)\
|
.order_by(corepos.CustomerClassic.card_number)\
|
||||||
.all()
|
.all()
|
||||||
s.expunge_all()
|
s.expunge_all()
|
||||||
|
|
||||||
|
|
|
@ -53,7 +53,7 @@ class corepos_problems_invalid_person_numbers(ProblemReportEmail):
|
||||||
def sample_data(self, request):
|
def sample_data(self, request):
|
||||||
from corepos.db.office_op import model as corepos
|
from corepos.db.office_op import model as corepos
|
||||||
|
|
||||||
customer = corepos.CustData(card_number=42,
|
customer = corepos.CustomerClassic(card_number=42,
|
||||||
first_name="Fred",
|
first_name="Fred",
|
||||||
last_name="Flintstone",
|
last_name="Flintstone",
|
||||||
person_number=2)
|
person_number=2)
|
||||||
|
|
|
@ -140,9 +140,9 @@ class TransactionImporter(FromCore, trainwreck_importing.model.TransactionImport
|
||||||
key='number')
|
key='number')
|
||||||
|
|
||||||
if 'customer_name' in self.fields:
|
if 'customer_name' in self.fields:
|
||||||
query = self.core_op_session.query(corepos.CustData)\
|
query = self.core_op_session.query(corepos.CustomerClassic)\
|
||||||
.filter(corepos.CustData.person_number == 1)
|
.filter(corepos.CustomerClassic.person_number == 1)
|
||||||
self.corepos_customers = self.cache_model(corepos.CustData,
|
self.corepos_customers = self.cache_model(corepos.CustomerClassic,
|
||||||
session=self.core_op_session,
|
session=self.core_op_session,
|
||||||
query=query,
|
query=query,
|
||||||
key='card_number')
|
key='card_number')
|
||||||
|
|
Loading…
Reference in a new issue