Add basic batch models
This commit is contained in:
parent
9299cd445f
commit
472f43896b
|
@ -1326,3 +1326,97 @@ class HouseCoupon(Base):
|
|||
|
||||
def __str__(self):
|
||||
return self.description or ''
|
||||
|
||||
|
||||
class BatchType(Base):
|
||||
"""
|
||||
Represents the definition of a batch type.
|
||||
"""
|
||||
__tablename__ = 'batchType'
|
||||
|
||||
id = sa.Column('batchTypeID', sa.Integer(), primary_key=True, autoincrement=False, nullable=False)
|
||||
|
||||
description = sa.Column('typeDesc', sa.String(length=50), nullable=True)
|
||||
|
||||
discount_type = sa.Column('discType', sa.Integer(), nullable=True)
|
||||
|
||||
dated_signs = sa.Column('datedSigns', sa.Boolean(), nullable=True, default=True)
|
||||
|
||||
special_order_eligible = sa.Column('specialOrderEligible', sa.Boolean(), nullable=True, default=True)
|
||||
|
||||
editor_ui = sa.Column('editorUI', sa.Boolean(), nullable=True, default=True)
|
||||
|
||||
allow_single_store = sa.Column('allowSingleStore', sa.Boolean(), nullable=True, default=False)
|
||||
|
||||
exit_inventory = sa.Column('exitInventory', sa.Boolean(), nullable=True, default=False)
|
||||
|
||||
def __str__(self):
|
||||
return self.description or ""
|
||||
|
||||
|
||||
class Batch(Base):
|
||||
"""
|
||||
Represents a batch.
|
||||
"""
|
||||
__tablename__ = 'batches'
|
||||
__table_args__ = (
|
||||
sa.ForeignKeyConstraint(['batchType'], ['batchType.batchTypeID']),
|
||||
)
|
||||
|
||||
id = sa.Column('batchID', sa.Integer(), primary_key=True, autoincrement=True, nullable=False)
|
||||
|
||||
start_date = sa.Column('startDate', sa.DateTime(), nullable=True)
|
||||
|
||||
end_date = sa.Column('endDate', sa.DateTime(), nullable=True)
|
||||
|
||||
name = sa.Column('batchName', sa.String(length=80), nullable=True)
|
||||
|
||||
batch_type_id = sa.Column('batchType', sa.Integer(), nullable=True)
|
||||
batch_type = orm.relationship(BatchType)
|
||||
|
||||
discount_type = sa.Column('discountType', sa.Integer(), nullable=True)
|
||||
|
||||
priority = sa.Column(sa.Integer(), nullable=True)
|
||||
|
||||
owner = sa.Column(sa.String(length=50), nullable=True)
|
||||
|
||||
trans_limit = sa.Column('transLimit', sa.Boolean(), nullable=True, default=False)
|
||||
|
||||
notes = sa.Column(sa.Text(), nullable=True)
|
||||
|
||||
def __str__(self):
|
||||
return self.name or ""
|
||||
|
||||
|
||||
class BatchItem(Base):
|
||||
"""
|
||||
Represents a batch "list" item.
|
||||
"""
|
||||
__tablename__ = 'batchList'
|
||||
__table_args__ = (
|
||||
sa.ForeignKeyConstraint(['batchID'], ['batches.batchID']),
|
||||
)
|
||||
|
||||
id = sa.Column('listID', sa.Integer(), primary_key=True, autoincrement=True, nullable=False)
|
||||
|
||||
batch_id = sa.Column('batchID', sa.Integer(), nullable=True)
|
||||
batch = orm.relationship(Batch, backref=orm.backref('items'))
|
||||
|
||||
upc = sa.Column(sa.String(length=13), nullable=True)
|
||||
|
||||
sale_price = sa.Column('salePrice', sa.Numeric(precision=9, scale=3), nullable=True)
|
||||
|
||||
group_sale_price = sa.Column('groupSalePrice', sa.Numeric(precision=9, scale=3), nullable=True)
|
||||
|
||||
active = sa.Column(sa.Boolean(), nullable=True)
|
||||
|
||||
price_method = sa.Column('pricemethod', sa.Integer(), nullable=True, default=0)
|
||||
|
||||
quantity = sa.Column(sa.Integer(), nullable=True, default=0)
|
||||
|
||||
sign_multiplier = sa.Column('signMultiplier', sa.Boolean(), nullable=True, default=True)
|
||||
|
||||
cost = sa.Column(sa.Numeric(precision=9, scale=3), nullable=True, default=0)
|
||||
|
||||
def __str__(self):
|
||||
return self.upc or ""
|
||||
|
|
|
@ -32,6 +32,17 @@ except ImportError:
|
|||
from ordereddict import OrderedDict
|
||||
|
||||
|
||||
BATCH_DISCOUNT_TYPE_PRICE_CHANGE = 0
|
||||
BATCH_DISCOUNT_TYPE_SALE_EVERYONE = 1
|
||||
BATCH_DISCOUNT_TYPE_SALE_RESTRICTED = 2
|
||||
|
||||
BATCH_DISCOUNT_TYPE = OrderedDict([
|
||||
(BATCH_DISCOUNT_TYPE_PRICE_CHANGE, "Price Change"),
|
||||
(BATCH_DISCOUNT_TYPE_SALE_EVERYONE, "Sale for everyone"),
|
||||
(BATCH_DISCOUNT_TYPE_SALE_RESTRICTED, "Member/Owner only sale"),
|
||||
])
|
||||
|
||||
|
||||
HOUSE_COUPON_MEMBER_ONLY_NO = 0
|
||||
HOUSE_COUPON_MEMBER_ONLY_YES = 1
|
||||
HOUSE_COUPON_MEMBER_ONLY_PLUS = 2
|
||||
|
|
Loading…
Reference in a new issue