Add schema, logic for importing CORE VendorItem -> ProductCost
This commit is contained in:
parent
b96a4bc7b9
commit
580f2093ae
5 changed files with 200 additions and 1 deletions
|
@ -26,4 +26,4 @@ Database schema extensions for CORE-POS integration
|
|||
|
||||
from .people import CorePerson, CoreCustomer, CoreMember
|
||||
from .products import (CoreDepartment, CoreSubdepartment,
|
||||
CoreVendor, CoreProduct)
|
||||
CoreVendor, CoreProduct, CoreProductCost)
|
||||
|
|
|
@ -168,3 +168,38 @@ class CoreProduct(model.Base):
|
|||
return str(self.product)
|
||||
|
||||
CoreProduct.make_proxy(model.Product, '_corepos', 'corepos_id')
|
||||
|
||||
|
||||
class CoreProductCost(model.Base):
|
||||
"""
|
||||
CORE-specific extensions to :class:`rattail:rattail.db.model.ProductCost`.
|
||||
"""
|
||||
__tablename__ = 'corepos_product_cost'
|
||||
__table_args__ = (
|
||||
sa.ForeignKeyConstraint(['uuid'], ['product_cost.uuid'],
|
||||
name='corepos_product_cost_fk_cost'),
|
||||
)
|
||||
__versioned__ = {}
|
||||
|
||||
uuid = model.uuid_column(default=None)
|
||||
cost = orm.relationship(
|
||||
model.ProductCost,
|
||||
doc="""
|
||||
Reference to the actual ProductCost 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 product cost.
|
||||
"""))
|
||||
|
||||
corepos_id = sa.Column(sa.Integer(), nullable=False, doc="""
|
||||
``vendorItemID`` value for the corresponding record within CORE-POS.
|
||||
""")
|
||||
|
||||
def __str__(self):
|
||||
return str(self.cost)
|
||||
|
||||
CoreProductCost.make_proxy(model.ProductCost, '_corepos', 'corepos_id')
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue