Fix session used for downloading CORE archive transactions

This commit is contained in:
Lance Edgar 2023-11-05 18:13:35 -06:00
parent 62d40b9ba9
commit 79591beec1

View file

@ -63,13 +63,16 @@ class TransactionDetailView(TransactionDetailMasterView):
return engines return engines
def make_isolated_session(self): def make_isolated_session(self):
from corepos.db.office_trans import Session as CoreTransArchiveSession app = self.get_rattail_app()
corepos = app.get_corepos_handler()
dbkey = self.get_current_engine_dbkey() dbkey = self.get_current_engine_dbkey()
if dbkey != 'default' and dbkey in self.rattail_config.core_office_trans_archive_engines: engine = self.rattail_config.core_office_arch_engines.get(dbkey)
return CoreTransArchiveSession(bind=self.rattail_config.core_office_trans_archive_engines[dbkey]) if not engine:
engine = self.rattail_config.core_office_arch_engine
assert engine
return CoreTransArchiveSession() return corepos.make_session_office_arch(bind=engine)
def defaults(config, **kwargs): def defaults(config, **kwargs):