Add VendorDepartment
and VendorItem
models
This commit is contained in:
parent
9b429eb293
commit
5f3ad79a95
|
@ -197,6 +197,40 @@ class VendorContact(Base):
|
||||||
notes = sa.Column(sa.Text(), nullable=True)
|
notes = sa.Column(sa.Text(), nullable=True)
|
||||||
|
|
||||||
|
|
||||||
|
class VendorDepartment(Base):
|
||||||
|
"""
|
||||||
|
Represents specific details / settings for a given vendor in the context of
|
||||||
|
a given department.
|
||||||
|
"""
|
||||||
|
__tablename__ = 'vendorDepartments'
|
||||||
|
__table_args__ = (
|
||||||
|
sa.ForeignKeyConstraint(['vendorID'], ['vendors.vendorID']),
|
||||||
|
sa.ForeignKeyConstraint(['deptID'], ['departments.dept_no']),
|
||||||
|
)
|
||||||
|
|
||||||
|
vendor_id = sa.Column('vendorID', sa.Integer(), primary_key=True, nullable=False)
|
||||||
|
vendor = orm.relationship(
|
||||||
|
Vendor,
|
||||||
|
doc="""
|
||||||
|
Reference to the :class:`Vendor` to which this record applies.
|
||||||
|
""")
|
||||||
|
|
||||||
|
department_id = sa.Column('deptID', sa.Integer(), primary_key=True, nullable=False)
|
||||||
|
department = orm.relationship(
|
||||||
|
Department,
|
||||||
|
doc="""
|
||||||
|
Reference to the :class:`Department` to which this record applies.
|
||||||
|
""")
|
||||||
|
|
||||||
|
name = sa.Column(sa.String(length=125), nullable=True)
|
||||||
|
|
||||||
|
margin = sa.Column(sa.Float(), nullable=True)
|
||||||
|
|
||||||
|
testing = sa.Column(sa.Float(), nullable=True)
|
||||||
|
|
||||||
|
pos_department_id = sa.Column('posDeptID', sa.Integer(), nullable=True)
|
||||||
|
|
||||||
|
|
||||||
class TaxRate(Base):
|
class TaxRate(Base):
|
||||||
"""
|
"""
|
||||||
Represents a tax rate. Note that this may be a "combo" of various local
|
Represents a tax rate. Note that this may be a "combo" of various local
|
||||||
|
@ -337,13 +371,15 @@ class Product(Base):
|
||||||
store_id = sa.Column(sa.SmallInteger(), nullable=True, default=0)
|
store_id = sa.Column(sa.SmallInteger(), nullable=True, default=0)
|
||||||
|
|
||||||
default_vendor_id = sa.Column(sa.Integer(), nullable=True, default=0)
|
default_vendor_id = sa.Column(sa.Integer(), nullable=True, default=0)
|
||||||
vendor = orm.relationship(
|
default_vendor = orm.relationship(
|
||||||
Vendor,
|
Vendor,
|
||||||
primaryjoin=Vendor.id == default_vendor_id,
|
primaryjoin=Vendor.id == default_vendor_id,
|
||||||
foreign_keys=[default_vendor_id],
|
foreign_keys=[default_vendor_id],
|
||||||
doc="""
|
doc="""
|
||||||
Reference to the default :class:`Vendor` from which the product is obtained.
|
Reference to the default :class:`Vendor` from which the product is obtained.
|
||||||
""")
|
""")
|
||||||
|
# TODO: deprecate / remove this?
|
||||||
|
vendor = orm.synonym('default_vendor')
|
||||||
|
|
||||||
current_origin_id = sa.Column(sa.Integer(), nullable=True, default=0)
|
current_origin_id = sa.Column(sa.Integer(), nullable=True, default=0)
|
||||||
|
|
||||||
|
@ -374,6 +410,63 @@ class ProductFlag(Base):
|
||||||
return self.description or ''
|
return self.description or ''
|
||||||
|
|
||||||
|
|
||||||
|
class VendorItem(Base):
|
||||||
|
"""
|
||||||
|
Represents a "source" for a given item, from a given vendor.
|
||||||
|
"""
|
||||||
|
__tablename__ = 'vendorItems'
|
||||||
|
__table_args__ = (
|
||||||
|
sa.ForeignKeyConstraint(['vendorID'], ['vendors.vendorID']),
|
||||||
|
)
|
||||||
|
|
||||||
|
sku = sa.Column(sa.String(length=13), primary_key=True, nullable=False)
|
||||||
|
|
||||||
|
vendor_id = sa.Column('vendorID', sa.Integer(), primary_key=True, nullable=False)
|
||||||
|
vendor = orm.relationship(
|
||||||
|
Vendor,
|
||||||
|
doc="""
|
||||||
|
Reference to the :class:`Vendor` from which the product is obtained.
|
||||||
|
""")
|
||||||
|
|
||||||
|
# TODO: this should be autoincrement, but not primary key??
|
||||||
|
vendor_item_id = sa.Column('vendorItemID', sa.Integer(), nullable=False)
|
||||||
|
|
||||||
|
upc = sa.Column(sa.String(length=13), nullable=False)
|
||||||
|
product = orm.relationship(
|
||||||
|
Product,
|
||||||
|
primaryjoin=Product.upc == upc,
|
||||||
|
foreign_keys=[upc],
|
||||||
|
doc="""
|
||||||
|
Reference to the :class:`Product` to which this record applies.
|
||||||
|
""",
|
||||||
|
backref=orm.backref(
|
||||||
|
'vendor_items',
|
||||||
|
order_by=vendor_item_id,
|
||||||
|
doc="""
|
||||||
|
List of :class:`VendorItem` records for this product.
|
||||||
|
"""))
|
||||||
|
|
||||||
|
brand = sa.Column(sa.String(length=50), nullable=True)
|
||||||
|
|
||||||
|
description = sa.Column(sa.String(length=50), nullable=True)
|
||||||
|
|
||||||
|
size = sa.Column(sa.String(length=25), nullable=True)
|
||||||
|
|
||||||
|
units = sa.Column(sa.Float(), nullable=True, default=1)
|
||||||
|
|
||||||
|
cost = sa.Column(sa.Numeric(precision=10, scale=3), nullable=True)
|
||||||
|
|
||||||
|
sale_cost = sa.Column('saleCost', sa.Numeric(precision=10, scale=3),
|
||||||
|
nullable=True, default=0)
|
||||||
|
|
||||||
|
vendor_department_id = sa.Column('vendorDept', sa.Integer(), nullable=True,
|
||||||
|
default=0)
|
||||||
|
|
||||||
|
srp = sa.Column(sa.Numeric(precision=10, scale=2), nullable=True)
|
||||||
|
|
||||||
|
modified = sa.Column(sa.DateTime(), nullable=True)
|
||||||
|
|
||||||
|
|
||||||
class Employee(Base):
|
class Employee(Base):
|
||||||
"""
|
"""
|
||||||
Represents an employee within the organization.
|
Represents an employee within the organization.
|
||||||
|
|
Loading…
Reference in a new issue