Move CORE DB import handler to more general location
This commit is contained in:
parent
ef823260ab
commit
24d4afa22b
|
@ -28,9 +28,9 @@ from collections import OrderedDict
|
|||
|
||||
from corepos.db.office_op import Session as CoreSession
|
||||
|
||||
from rattail.importing.handlers import FromSQLAlchemyHandler, ToSQLAlchemyHandler
|
||||
from rattail.importing.handlers import FromSQLAlchemyHandler
|
||||
from rattail.importing.sqlalchemy import FromSQLAlchemySameToSame
|
||||
from rattail_corepos.corepos.importing import db as corepos_importing
|
||||
from rattail_corepos.corepos.office.importing import db as corepos_importing
|
||||
|
||||
|
||||
class FromCoreHandler(FromSQLAlchemyHandler):
|
||||
|
@ -44,15 +44,8 @@ class FromCoreHandler(FromSQLAlchemyHandler):
|
|||
return CoreSession()
|
||||
|
||||
|
||||
class ToCoreHandler(ToSQLAlchemyHandler):
|
||||
"""
|
||||
Base class for import handlers which target a CORE database on the local side.
|
||||
"""
|
||||
local_title = "CORE"
|
||||
local_key = 'corepos_db_office_op'
|
||||
|
||||
def make_session(self):
|
||||
return CoreSession()
|
||||
# TODO: deprecate / remove this
|
||||
ToCoreHandler = corepos_importing.model.ToCoreHandler
|
||||
|
||||
|
||||
class FromCoreToCoreBase(object):
|
||||
|
@ -77,7 +70,7 @@ class FromCoreToCoreBase(object):
|
|||
return importers
|
||||
|
||||
|
||||
class FromCoreToCoreImport(FromCoreToCoreBase, FromCoreHandler, ToCoreHandler):
|
||||
class FromCoreToCoreImport(FromCoreToCoreBase, FromCoreHandler, corepos_importing.model.ToCoreHandler):
|
||||
"""
|
||||
Handler for CORE (other) -> CORE (local) data import.
|
||||
|
||||
|
@ -97,7 +90,7 @@ class FromCoreToCoreImport(FromCoreToCoreBase, FromCoreHandler, ToCoreHandler):
|
|||
return CoreSession(bind=self.config.corepos_engines[self.dbkey])
|
||||
|
||||
|
||||
class FromCoreToCoreExport(FromCoreToCoreBase, FromCoreHandler, ToCoreHandler):
|
||||
class FromCoreToCoreExport(FromCoreToCoreBase, FromCoreHandler, corepos_importing.model.ToCoreHandler):
|
||||
"""
|
||||
Handler for CORE (local) -> CORE (other) data export.
|
||||
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
################################################################################
|
||||
#
|
||||
# Rattail -- Retail Software Framework
|
||||
# Copyright © 2010-2020 Lance Edgar
|
||||
# Copyright © 2010-2023 Lance Edgar
|
||||
#
|
||||
# This file is part of Rattail.
|
||||
#
|
||||
|
@ -31,12 +31,22 @@ CORE-POS model importers (direct DB)
|
|||
which may exist.
|
||||
"""
|
||||
|
||||
from sqlalchemy.orm.exc import NoResultFound
|
||||
from corepos.db.office_op import model as corepos, Session as CoreSession
|
||||
from corepos.db.office_trans import model as coretrans
|
||||
|
||||
from rattail import importing
|
||||
from rattail.importing.handlers import ToSQLAlchemyHandler
|
||||
|
||||
from corepos.db.office_op import model as corepos
|
||||
from corepos.db.office_trans import model as coretrans
|
||||
|
||||
class ToCoreHandler(ToSQLAlchemyHandler):
|
||||
"""
|
||||
Base class for import handlers which target a CORE database on the local side.
|
||||
"""
|
||||
local_title = "CORE"
|
||||
local_key = 'corepos_db_office_op'
|
||||
|
||||
def make_session(self):
|
||||
return CoreSession()
|
||||
|
||||
|
||||
class ToCore(importing.ToSQLAlchemy):
|
||||
|
|
Loading…
Reference in a new issue