diff --git a/rattail_corepos/batch/coremember.py b/rattail_corepos/batch/coremember.py index 7ee9605..56beedd 100644 --- a/rattail_corepos/batch/coremember.py +++ b/rattail_corepos/batch/coremember.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. # @@ -187,7 +187,7 @@ class CoreMemberBatchHandler(BatchHandler): row.status_text = "row has no card number" return - core_member = self.core_session.query(corepos.MemberInfo).get(row.card_number) + core_member = self.core_session.get(corepos.MemberInfo, row.card_number) if not core_member: row.status_code = row.STATUS_MEMBER_NOT_FOUND row.status_text = "matching record not found in CORE" @@ -250,7 +250,7 @@ class CoreMemberBatchHandler(BatchHandler): fields = batch.get_param('fields') def update(row, i): - core_member = core_session.query(corepos.MemberInfo).get(row.card_number) + core_member = core_session.get(corepos.MemberInfo, row.card_number) if not core_member: log.warning("CORE member not found for row %s with card number: %s", row.uuid, row.card_number) diff --git a/rattail_corepos/datasync/corepos.py b/rattail_corepos/datasync/corepos.py index 94fbdd4..78a0f1e 100644 --- a/rattail_corepos/datasync/corepos.py +++ b/rattail_corepos/datasync/corepos.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. # @@ -241,37 +241,37 @@ class FromRattailToCore(DataSyncImportConsumer): def get_customers(self, session, change): if change.payload_type == 'Customer': - customer = session.query(model.Customer).get(change.payload_key) + customer = session.get(model.Customer, change.payload_key) if customer: return [customer] if change.payload_type == 'CustomerPerson': - cp = session.query(model.CustomerPerson).get(change.payload_key) + cp = session.get(model.CustomerPerson, change.payload_key) if cp: return [cp.customer] if change.payload_type == 'Person': - person = session.query(model.Person).get(change.payload_key) + person = session.get(model.Person, change.payload_key) if person: return person.customers if change.payload_type == 'CustomerMailingAddress': - address = session.query(model.CustomerMailingAddress).get(change.payload_key) + address = session.get(model.CustomerMailingAddress, change.payload_key) if address: return [address.customer] if change.payload_type == 'PersonPhoneNumber': - phone = session.query(model.PersonPhoneNumber).get(change.payload_key) + phone = session.get(model.PersonPhoneNumber, change.payload_key) if phone: return phone.person.customers if change.payload_type == 'PersonEmailAddress': - email = session.query(model.PersonEmailAddress).get(change.payload_key) + email = session.get(model.PersonEmailAddress, change.payload_key) if email: return email.person.customers if change.payload_type == 'Member': - member = session.query(model.Member).get(change.payload_key) + member = session.get(model.Member, change.payload_key) if member: return [member.customer] @@ -280,24 +280,24 @@ class FromRattailToCore(DataSyncImportConsumer): def get_vendor(self, session, change): if change.payload_type == 'Vendor': - return session.query(model.Vendor).get(change.payload_key) + return session.get(model.Vendor, change.payload_key) if change.payload_type == 'VendorPhoneNumber': - phone = session.query(model.VendorPhoneNumber).get(change.payload_key) + phone = session.get(model.VendorPhoneNumber, change.payload_key) if phone: return phone.vendor if change.payload_type == 'VendorEmailAddress': - email = session.query(model.VendorEmailAddress).get(change.payload_key) + email = session.get(model.VendorEmailAddress, change.payload_key) if email: return email.vendor def get_product(self, session, change): if change.payload_type == 'Product': - return session.query(model.Product).get(change.payload_key) + return session.get(model.Product, change.payload_key) if change.payload_type == 'ProductPrice': - price = session.query(model.ProductPrice).get(change.payload_key) + price = session.get(model.ProductPrice, change.payload_key) if price: return price.product