More refactoring, Query.get() => Session.get()

This commit is contained in:
Lance Edgar 2023-02-12 09:37:31 -06:00
parent 0b5930a511
commit 82892be096
2 changed files with 3 additions and 5 deletions

View file

@ -235,8 +235,7 @@ class FromRattailToCore(DataSyncImportConsumer):
self.invoke_importer(session, change) self.invoke_importer(session, change)
def get_host_object(self, session, change): def get_host_object(self, session, change):
return session.query(getattr(model, change.payload_type))\ return session.get(getattr(model, change.payload_type), change.payload_key)
.get(change.payload_key)
def get_customers(self, session, change): def get_customers(self, session, change):

View file

@ -2,7 +2,7 @@
################################################################################ ################################################################################
# #
# Rattail -- Retail Software Framework # Rattail -- Retail Software Framework
# Copyright © 2010-2022 Lance Edgar # Copyright © 2010-2023 Lance Edgar
# #
# This file is part of Rattail. # This file is part of Rattail.
# #
@ -185,5 +185,4 @@ class FromCOREPOSToRattailProducts(FromCOREPOSToRattailBase):
else: else:
# try to fetch CORE POS object via typical method # try to fetch CORE POS object via typical method
Model = getattr(corepos, change.payload_type) Model = getattr(corepos, change.payload_type)
return self.corepos_session.query(Model)\ return self.corepos_session.get(Model, int(change.payload_key))
.get(int(change.payload_key))