Add employee importer for CORE -> Rattail, and CORE cashier auth handler
This commit is contained in:
parent
fd5d3142ed
commit
117442f8db
9 changed files with 255 additions and 1 deletions
|
@ -0,0 +1,51 @@
|
|||
# -*- coding: utf-8; -*-
|
||||
"""add core_employee
|
||||
|
||||
Revision ID: 1f2e2f57c90b
|
||||
Revises: c40a6ec00428
|
||||
Create Date: 2023-10-01 19:03:56.921897
|
||||
|
||||
"""
|
||||
|
||||
# revision identifiers, used by Alembic.
|
||||
revision = '1f2e2f57c90b'
|
||||
down_revision = 'c40a6ec00428'
|
||||
branch_labels = None
|
||||
depends_on = None
|
||||
|
||||
from alembic import op
|
||||
import sqlalchemy as sa
|
||||
import rattail.db.types
|
||||
|
||||
|
||||
|
||||
def upgrade():
|
||||
|
||||
# corepos_employee
|
||||
op.create_table('corepos_employee',
|
||||
sa.Column('uuid', sa.String(length=32), nullable=False),
|
||||
sa.Column('corepos_number', sa.Integer(), nullable=True),
|
||||
sa.ForeignKeyConstraint(['uuid'], ['employee.uuid'], name='corepos_employee_fk_employee'),
|
||||
sa.PrimaryKeyConstraint('uuid')
|
||||
)
|
||||
op.create_table('corepos_employee_version',
|
||||
sa.Column('uuid', sa.String(length=32), autoincrement=False, nullable=False),
|
||||
sa.Column('corepos_number', sa.Integer(), autoincrement=False, nullable=True),
|
||||
sa.Column('transaction_id', sa.BigInteger(), autoincrement=False, nullable=False),
|
||||
sa.Column('end_transaction_id', sa.BigInteger(), nullable=True),
|
||||
sa.Column('operation_type', sa.SmallInteger(), nullable=False),
|
||||
sa.PrimaryKeyConstraint('uuid', 'transaction_id')
|
||||
)
|
||||
op.create_index(op.f('ix_corepos_employee_version_end_transaction_id'), 'corepos_employee_version', ['end_transaction_id'], unique=False)
|
||||
op.create_index(op.f('ix_corepos_employee_version_operation_type'), 'corepos_employee_version', ['operation_type'], unique=False)
|
||||
op.create_index(op.f('ix_corepos_employee_version_transaction_id'), 'corepos_employee_version', ['transaction_id'], unique=False)
|
||||
|
||||
|
||||
def downgrade():
|
||||
|
||||
# corepos_employee
|
||||
op.drop_index(op.f('ix_corepos_employee_version_transaction_id'), table_name='corepos_employee_version')
|
||||
op.drop_index(op.f('ix_corepos_employee_version_operation_type'), table_name='corepos_employee_version')
|
||||
op.drop_index(op.f('ix_corepos_employee_version_end_transaction_id'), table_name='corepos_employee_version')
|
||||
op.drop_table('corepos_employee_version')
|
||||
op.drop_table('corepos_employee')
|
|
@ -25,7 +25,8 @@ Database schema extensions for CORE-POS integration
|
|||
"""
|
||||
|
||||
from .stores import CoreStore, CoreTender
|
||||
from .people import (CorePerson, CoreCustomer, CoreCustomerShopper,
|
||||
from .people import (CorePerson, CoreEmployee,
|
||||
CoreCustomer, CoreCustomerShopper,
|
||||
CoreMember, CoreMemberEquityPayment)
|
||||
from .products import (CoreDepartment, CoreSubdepartment,
|
||||
CoreVendor, CoreProduct, CoreProductCost)
|
||||
|
|
28
rattail_corepos/db/model/_complete.py
Normal file
28
rattail_corepos/db/model/_complete.py
Normal file
|
@ -0,0 +1,28 @@
|
|||
# -*- coding: utf-8; -*-
|
||||
################################################################################
|
||||
#
|
||||
# Rattail -- Retail Software Framework
|
||||
# Copyright © 2010-2023 Lance Edgar
|
||||
#
|
||||
# This file is part of Rattail.
|
||||
#
|
||||
# Rattail is free software: you can redistribute it and/or modify it under the
|
||||
# terms of the GNU General Public License as published by the Free Software
|
||||
# Foundation, either version 3 of the License, or (at your option) any later
|
||||
# version.
|
||||
#
|
||||
# Rattail is distributed in the hope that it will be useful, but WITHOUT ANY
|
||||
# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
|
||||
# FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
|
||||
# details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License along with
|
||||
# Rattail. If not, see <http://www.gnu.org/licenses/>.
|
||||
#
|
||||
################################################################################
|
||||
"""
|
||||
A "complete" data model including CORE-POS integration
|
||||
"""
|
||||
|
||||
from rattail.db.model import *
|
||||
from rattail_corepos.db.model import *
|
|
@ -65,6 +65,41 @@ class CorePerson(model.Base):
|
|||
CorePerson.make_proxy(model.Person, '_corepos', 'corepos_customer_id')
|
||||
|
||||
|
||||
class CoreEmployee(model.Base):
|
||||
"""
|
||||
CORE-specific extensions to :class:`~rattail:rattail.db.model.Employee`
|
||||
"""
|
||||
__tablename__ = 'corepos_employee'
|
||||
__table_args__ = (
|
||||
sa.ForeignKeyConstraint(['uuid'], ['employee.uuid'],
|
||||
name='corepos_employee_fk_employee'),
|
||||
)
|
||||
__versioned__ = {}
|
||||
|
||||
uuid = model.uuid_column(default=None)
|
||||
employee = orm.relationship(
|
||||
model.Employee,
|
||||
doc="""
|
||||
Reference to the actual employee record, which this one extends.
|
||||
""",
|
||||
backref=orm.backref(
|
||||
'_corepos',
|
||||
uselist=False,
|
||||
cascade='all, delete-orphan',
|
||||
doc="""
|
||||
Reference to the CORE-POS extension record for this employee.
|
||||
"""))
|
||||
|
||||
corepos_number = sa.Column(sa.Integer(), nullable=True, doc="""
|
||||
``employees.emp_no`` value for this employee, within CORE-POS.
|
||||
""")
|
||||
|
||||
def __str__(self):
|
||||
return str(self.employee)
|
||||
|
||||
CoreEmployee.make_proxy(model.Employee, '_corepos', 'corepos_number')
|
||||
|
||||
|
||||
class CoreCustomer(model.Base):
|
||||
"""
|
||||
CORE-specific extensions to :class:`rattail:rattail.db.model.Customer`.
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue