Add employee importer for CORE -> Rattail, and CORE cashier auth handler

This commit is contained in:
Lance Edgar 2023-10-01 19:40:46 -05:00
parent fd5d3142ed
commit 117442f8db
9 changed files with 255 additions and 1 deletions

View file

@ -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)

View 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 *

View file

@ -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`.