Add Product.subdepartment
relationship
This commit is contained in:
parent
9466b16b64
commit
e0058c003d
|
@ -242,6 +242,7 @@ class Product(Base):
|
||||||
__tablename__ = 'products'
|
__tablename__ = 'products'
|
||||||
__table_args__ = (
|
__table_args__ = (
|
||||||
sa.ForeignKeyConstraint(['department'], ['departments.dept_no']),
|
sa.ForeignKeyConstraint(['department'], ['departments.dept_no']),
|
||||||
|
sa.ForeignKeyConstraint(['subdept'], ['subdepts.subdept_no']),
|
||||||
sa.ForeignKeyConstraint(['tax'], ['taxrates.id']),
|
sa.ForeignKeyConstraint(['tax'], ['taxrates.id']),
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -276,6 +277,13 @@ class Product(Base):
|
||||||
end_date = sa.Column(sa.DateTime(), nullable=True)
|
end_date = sa.Column(sa.DateTime(), nullable=True)
|
||||||
|
|
||||||
department_number = sa.Column('department', sa.SmallInteger(), nullable=True)
|
department_number = sa.Column('department', sa.SmallInteger(), nullable=True)
|
||||||
|
department = orm.relationship(
|
||||||
|
Department,
|
||||||
|
primaryjoin=Department.number == department_number,
|
||||||
|
foreign_keys=[department_number],
|
||||||
|
doc="""
|
||||||
|
Reference to the :class:`Department` to which the product belongs.
|
||||||
|
""")
|
||||||
|
|
||||||
size = sa.Column(sa.String(length=9), nullable=True)
|
size = sa.Column(sa.String(length=9), nullable=True)
|
||||||
|
|
||||||
|
@ -317,6 +325,13 @@ class Product(Base):
|
||||||
flags = sa.Column('numflag', sa.Integer(), nullable=True, default=0)
|
flags = sa.Column('numflag', sa.Integer(), nullable=True, default=0)
|
||||||
|
|
||||||
subdepartment_number = sa.Column('subdept', sa.SmallInteger(), nullable=True)
|
subdepartment_number = sa.Column('subdept', sa.SmallInteger(), nullable=True)
|
||||||
|
subdepartment = orm.relationship(
|
||||||
|
Subdepartment,
|
||||||
|
primaryjoin=Subdepartment.number == subdepartment_number,
|
||||||
|
foreign_keys=[subdepartment_number],
|
||||||
|
doc="""
|
||||||
|
Reference to the :class:`Subdepartment` to which the product belongs.
|
||||||
|
""")
|
||||||
|
|
||||||
deposit = sa.Column(sa.Float(), nullable=True)
|
deposit = sa.Column(sa.Float(), nullable=True)
|
||||||
|
|
||||||
|
@ -325,17 +340,6 @@ 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)
|
||||||
|
|
||||||
current_origin_id = sa.Column(sa.Integer(), nullable=True, default=0)
|
|
||||||
|
|
||||||
department = orm.relationship(
|
|
||||||
Department,
|
|
||||||
primaryjoin=Department.number == department_number,
|
|
||||||
foreign_keys=[department_number],
|
|
||||||
doc="""
|
|
||||||
Reference to the :class:`Department` to which the product belongs.
|
|
||||||
""")
|
|
||||||
|
|
||||||
vendor = orm.relationship(
|
vendor = orm.relationship(
|
||||||
Vendor,
|
Vendor,
|
||||||
primaryjoin=Vendor.id == default_vendor_id,
|
primaryjoin=Vendor.id == default_vendor_id,
|
||||||
|
@ -344,6 +348,8 @@ class Product(Base):
|
||||||
Reference to the default :class:`Vendor` from which the product is obtained.
|
Reference to the default :class:`Vendor` from which the product is obtained.
|
||||||
""")
|
""")
|
||||||
|
|
||||||
|
current_origin_id = sa.Column(sa.Integer(), nullable=True, default=0)
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def full_description(self):
|
def full_description(self):
|
||||||
fields = ['brand', 'description', 'size']
|
fields = ['brand', 'description', 'size']
|
||||||
|
|
Loading…
Reference in a new issue