From 6dbf7cf174a3c70f16851492c852416844049cdd Mon Sep 17 00:00:00 2001 From: Lance Edgar Date: Thu, 30 Jul 2020 21:07:39 -0500 Subject: [PATCH] Use custom data model where possible, when importing from CORE API not sure if this really does much good, but what the heck --- rattail_corepos/importing/corepos/api.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/rattail_corepos/importing/corepos/api.py b/rattail_corepos/importing/corepos/api.py index 603d0ef..71de890 100644 --- a/rattail_corepos/importing/corepos/api.py +++ b/rattail_corepos/importing/corepos/api.py @@ -34,7 +34,6 @@ from sqlalchemy.orm.exc import NoResultFound from corepos.api import CoreWebAPI from rattail import importing -from rattail.db import model from rattail.gpc import GPC from rattail.util import OrderedDict from rattail.time import localtime, make_utc @@ -219,6 +218,7 @@ class PersonImporter(FromCOREPOSAPI, corepos_importing.model.PersonImporter): if hasattr(self, 'customers'): return self.customers.get(id) + model = self.config.get_model() try: return self.session.query(model.Customer)\ .filter(model.Customer.id == id)\ @@ -305,6 +305,7 @@ class CustomerPersonImporter(FromCOREPOSAPI, importing.model.CustomerPersonImpor if hasattr(self, 'customers'): return self.customers.get(account_id) + model = self.config.get_model() try: return self.session.query(model.Customer)\ .join(model.CoreCustomer)\ @@ -554,6 +555,7 @@ class MemberImporter(FromCOREPOSAPI, corepos_importing.model.MemberImporter): def setup(self): super(MemberImporter, self).setup() + model = self.config.get_model() self.customers = self.cache_model(model.Customer, key='number') def get_host_objects(self): @@ -563,6 +565,7 @@ class MemberImporter(FromCOREPOSAPI, corepos_importing.model.MemberImporter): if hasattr(self, 'customers'): return self.customers.get(number) + model = self.config.get_model() try: return self.session.query(model.Customer)\ .filter(model.Customer.number == number)\