Add subdepartment to core "product" batch row mixin schema
and populate that, for pricing batches
This commit is contained in:
parent
d7dce05990
commit
5291479bdd
|
@ -110,10 +110,15 @@ class PricingBatchHandler(BatchHandler):
|
|||
row.brand_name = six.text_type(product.brand or '')
|
||||
row.description = product.description
|
||||
row.size = product.size
|
||||
|
||||
department = product.department
|
||||
row.department_number = department.number if department else None
|
||||
row.department_name = department.name if department else None
|
||||
|
||||
subdept = product.subdepartment
|
||||
row.subdepartment_number = subdept.number if subdept else None
|
||||
row.subdepartment_name = subdept.name if subdept else None
|
||||
|
||||
cost = product.cost
|
||||
row.vendor = cost.vendor if cost else None
|
||||
row.regular_unit_cost = cost.unit_cost if cost else None
|
||||
|
|
|
@ -0,0 +1,55 @@
|
|||
# -*- coding: utf-8; -*-
|
||||
"""add product_batch.subdepartment
|
||||
|
||||
Revision ID: bd7acb7028da
|
||||
Revises: c02430f167c2
|
||||
Create Date: 2018-12-18 16:42:42.152911
|
||||
|
||||
"""
|
||||
|
||||
from __future__ import unicode_literals, absolute_import
|
||||
|
||||
# revision identifiers, used by Alembic.
|
||||
revision = 'bd7acb7028da'
|
||||
down_revision = 'c02430f167c2'
|
||||
branch_labels = None
|
||||
depends_on = None
|
||||
|
||||
from alembic import op
|
||||
import sqlalchemy as sa
|
||||
import rattail.db.types
|
||||
|
||||
|
||||
|
||||
def upgrade():
|
||||
|
||||
# product-related batches...
|
||||
op.add_column('batch_handheld_row', sa.Column('subdepartment_name', sa.String(length=30), nullable=True))
|
||||
op.add_column('batch_handheld_row', sa.Column('subdepartment_number', sa.Integer(), nullable=True))
|
||||
op.add_column('batch_inventory_row', sa.Column('subdepartment_name', sa.String(length=30), nullable=True))
|
||||
op.add_column('batch_inventory_row', sa.Column('subdepartment_number', sa.Integer(), nullable=True))
|
||||
op.add_column('batch_pricing_row', sa.Column('subdepartment_name', sa.String(length=30), nullable=True))
|
||||
op.add_column('batch_pricing_row', sa.Column('subdepartment_number', sa.Integer(), nullable=True))
|
||||
op.add_column('label_batch_row', sa.Column('subdepartment_name', sa.String(length=30), nullable=True))
|
||||
op.add_column('label_batch_row', sa.Column('subdepartment_number', sa.Integer(), nullable=True))
|
||||
op.add_column('vendor_catalog_row', sa.Column('subdepartment_name', sa.String(length=30), nullable=True))
|
||||
op.add_column('vendor_catalog_row', sa.Column('subdepartment_number', sa.Integer(), nullable=True))
|
||||
op.add_column('vendor_invoice_row', sa.Column('subdepartment_name', sa.String(length=30), nullable=True))
|
||||
op.add_column('vendor_invoice_row', sa.Column('subdepartment_number', sa.Integer(), nullable=True))
|
||||
|
||||
|
||||
def downgrade():
|
||||
|
||||
# product-related batches...
|
||||
op.drop_column('vendor_invoice_row', 'subdepartment_number')
|
||||
op.drop_column('vendor_invoice_row', 'subdepartment_name')
|
||||
op.drop_column('vendor_catalog_row', 'subdepartment_number')
|
||||
op.drop_column('vendor_catalog_row', 'subdepartment_name')
|
||||
op.drop_column('label_batch_row', 'subdepartment_number')
|
||||
op.drop_column('label_batch_row', 'subdepartment_name')
|
||||
op.drop_column('batch_pricing_row', 'subdepartment_number')
|
||||
op.drop_column('batch_pricing_row', 'subdepartment_name')
|
||||
op.drop_column('batch_inventory_row', 'subdepartment_number')
|
||||
op.drop_column('batch_inventory_row', 'subdepartment_name')
|
||||
op.drop_column('batch_handheld_row', 'subdepartment_number')
|
||||
op.drop_column('batch_handheld_row', 'subdepartment_name')
|
|
@ -439,3 +439,11 @@ class ProductBatchRowMixin(BatchRowMixin):
|
|||
department_name = sa.Column(sa.String(length=30), nullable=True, doc="""
|
||||
Name of the department to which the product belongs.
|
||||
""")
|
||||
|
||||
subdepartment_number = sa.Column(sa.Integer(), nullable=True, doc="""
|
||||
Number of the subdepartment to which the product belongs.
|
||||
""")
|
||||
|
||||
subdepartment_name = sa.Column(sa.String(length=30), nullable=True, doc="""
|
||||
Name of the subdepartment to which the product belongs.
|
||||
""")
|
||||
|
|
Loading…
Reference in a new issue