Add importer for tax rates from CORE

This commit is contained in:
Lance Edgar 2023-10-07 16:28:12 -05:00
parent 6ef2e67f76
commit cf90ca5704
5 changed files with 122 additions and 1 deletions

View file

@ -24,7 +24,7 @@
Database schema extensions for CORE-POS integration
"""
from .stores import CoreStore, CoreTender
from .stores import CoreStore, CoreTax, CoreTender
from .people import (CorePerson, CoreEmployee,
CoreCustomer, CoreCustomerShopper,
CoreMember, CoreMemberEquityPayment)

View file

@ -65,6 +65,41 @@ class CoreStore(model.Base):
CoreStore.make_proxy(model.Store, '_corepos', 'corepos_id')
class CoreTax(model.Base):
"""
CORE-specific extensions to :class:`rattail:rattail.db.model.Tax`.
"""
__tablename__ = 'corepos_tax'
__table_args__ = (
sa.ForeignKeyConstraint(['uuid'], ['tax.uuid'],
name='corepos_tax_fk_tax'),
)
__versioned__ = {}
uuid = model.uuid_column(default=None)
tax = orm.relationship(
model.Tax,
doc="""
Reference to the actual tax 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 tax.
"""))
corepos_id = sa.Column(sa.Integer(), nullable=False, doc="""
``taxrates.id`` value for this tax, within CORE-POS.
""")
def __str__(self):
return str(self.tax)
CoreTax.make_proxy(model.Tax, '_corepos', 'corepos_id')
class CoreTender(model.Base):
"""
CORE-specific extensions to :class:`rattail:rattail.db.model.Tender`.