fix: misc. cleanup for sales batch models
This commit is contained in:
		
							parent
							
								
									ab56a35acc
								
							
						
					
					
						commit
						01852ceecc
					
				
					 1 changed files with 11 additions and 9 deletions
				
			
		|  | @ -1636,7 +1636,9 @@ class BatchType(Base): | |||
|     """ | ||||
|     __tablename__ = 'batchType' | ||||
| 
 | ||||
|     id = sa.Column('batchTypeID', sa.Integer(), primary_key=True, autoincrement=False, nullable=False) | ||||
|     # nb. this is *not* autoincrement for some reason; must | ||||
|     # calculate new ID manually based on max existing | ||||
|     id = sa.Column('batchTypeID', sa.Integer(), nullable=False, primary_key=True, autoincrement=False) | ||||
| 
 | ||||
|     description = sa.Column('typeDesc', sa.String(length=50), nullable=True) | ||||
| 
 | ||||
|  | @ -1661,9 +1663,6 @@ 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) | ||||
| 
 | ||||
|  | @ -1673,7 +1672,8 @@ class Batch(Base): | |||
| 
 | ||||
|     name = sa.Column('batchName', sa.String(length=80), nullable=True) | ||||
| 
 | ||||
|     batch_type_id = sa.Column('batchType', sa.Integer(), nullable=True) | ||||
|     batch_type_id = sa.Column('batchType', sa.Integer(), | ||||
|                               sa.ForeignKey('batchType.batchTypeID'), nullable=True) | ||||
|     batch_type = orm.relationship(BatchType) | ||||
| 
 | ||||
|     discount_type = sa.Column('discountType', sa.Integer(), nullable=True) | ||||
|  | @ -1695,16 +1695,18 @@ 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_id = sa.Column('batchID', sa.Integer(), | ||||
|                          sa.ForeignKey('batches.batchID'), nullable=True) | ||||
|     batch = orm.relationship(Batch, backref=orm.backref('items')) | ||||
| 
 | ||||
|     upc = sa.Column(sa.String(length=13), nullable=True) | ||||
|     product = orm.relationship( | ||||
|         Product, | ||||
|         primaryjoin=Product.upc == upc, | ||||
|         foreign_keys=[upc]) | ||||
| 
 | ||||
|     sale_price = sa.Column('salePrice', sa.Numeric(precision=9, scale=3), nullable=True) | ||||
| 
 | ||||
|  |  | |||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue