diff --git a/corepos/db/model.py b/corepos/db/model.py index 67ac09760abb13c886681258a695733163c7ffa2..c79d2de2418ea9caa6548ccb99e65f714de5a0bf 100644 --- a/corepos/db/model.py +++ b/corepos/db/model.py @@ -43,34 +43,35 @@ class Department(Base): """ __tablename__ = 'departments' - dept_no = sa.Column(sa.SmallInteger(), primary_key=True, autoincrement=False, nullable=False) + number = sa.Column('dept_no', sa.SmallInteger(), primary_key=True, autoincrement=False, nullable=False) - dept_name = sa.Column(sa.String(length=30), nullable=True) + name = sa.Column('dept_name', sa.String(length=30), nullable=True) - dept_tax = sa.Column(sa.Boolean(), nullable=True) + tax = sa.Column(sa.Boolean(), nullable=True) - dept_fs = sa.Column(sa.Boolean(), nullable=True) + food_stampable = sa.Column('dept_fs', sa.Boolean(), nullable=True) - dept_limit = sa.Column(sa.Float(), nullable=True) + limit = sa.Column('dept_limit', sa.Float(), nullable=True) - dept_minimum = sa.Column(sa.Float(), nullable=True) + minimum = sa.Column('dept_minimum', sa.Float(), nullable=True) - dept_discount = sa.Column(sa.Boolean(), nullable=True) + discount = sa.Column('dept_discount', sa.Boolean(), nullable=True) + # TODO: probably should rename this attribute, but to what? dept_see_id = sa.Column(sa.Boolean(), nullable=True) modified = sa.Column(sa.DateTime(), nullable=True) - modifiedby = sa.Column(sa.Integer(), nullable=True) + modified_by_id = sa.Column('modifiedby', sa.Integer(), nullable=True) margin = sa.Column(sa.Float(), nullable=False, default=0) - salesCode = sa.Column(sa.Integer(), nullable=False, default=0) + sales_code = sa.Column('salesCode', sa.Integer(), nullable=False, default=0) - memberOnly = sa.Column(sa.SmallInteger(), nullable=False, default=0) + member_only = sa.Column('memberOnly', sa.SmallInteger(), nullable=False, default=0) def __str__(self): - return self.dept_name or '' + return self.name or '' @six.python_2_unicode_compatible @@ -256,7 +257,7 @@ class Product(Base): department = orm.relationship( Department, - primaryjoin=Department.dept_no == dept_no, + primaryjoin=Department.number == dept_no, foreign_keys=[dept_no], doc=""" Reference to the :class:`Department` to which the product belongs.