Add "origin" models for office_op schema
This commit is contained in:
		
							parent
							
								
									ef1a25f0dc
								
							
						
					
					
						commit
						9299cd445f
					
				
					 1 changed files with 78 additions and 0 deletions
				
			
		| 
						 | 
				
			
			@ -310,6 +310,84 @@ class LikeCode(Base):
 | 
			
		|||
        return self.description or ""
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
class OriginCountry(Base):
 | 
			
		||||
    """
 | 
			
		||||
    Represents a country which relates to the "origin" for some product(s).
 | 
			
		||||
    """
 | 
			
		||||
    __tablename__ = 'originCountry'
 | 
			
		||||
 | 
			
		||||
    id = sa.Column('countryID', sa.Integer(), primary_key=True, autoincrement=True, nullable=False)
 | 
			
		||||
 | 
			
		||||
    name = sa.Column(sa.String(length=50), nullable=True)
 | 
			
		||||
 | 
			
		||||
    abbreviation = sa.Column('abbr', sa.String(length=5), nullable=True)
 | 
			
		||||
 | 
			
		||||
    def __str__(self):
 | 
			
		||||
        return self.name or self.abbreviation or ""
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
class OriginStateProv(Base):
 | 
			
		||||
    """
 | 
			
		||||
    Represents a state/province which relates to the "origin" for some product(s).
 | 
			
		||||
    """
 | 
			
		||||
    __tablename__ = 'originStateProv'
 | 
			
		||||
 | 
			
		||||
    id = sa.Column('stateProvID', sa.Integer(), primary_key=True, autoincrement=True, nullable=False)
 | 
			
		||||
 | 
			
		||||
    name = sa.Column(sa.String(length=50), nullable=True)
 | 
			
		||||
 | 
			
		||||
    abbreviation = sa.Column('abbr', sa.String(length=5), nullable=True)
 | 
			
		||||
 | 
			
		||||
    def __str__(self):
 | 
			
		||||
        return self.name or self.abbreviation or ""
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
class OriginCustomRegion(Base):
 | 
			
		||||
    """
 | 
			
		||||
    Represents a custom region which relates to the "origin" for some product(s).
 | 
			
		||||
    """
 | 
			
		||||
    __tablename__ = 'originCustomRegion'
 | 
			
		||||
 | 
			
		||||
    id = sa.Column('customID', sa.Integer(), primary_key=True, autoincrement=True, nullable=False)
 | 
			
		||||
 | 
			
		||||
    name = sa.Column(sa.String(length=50), nullable=True)
 | 
			
		||||
 | 
			
		||||
    def __str__(self):
 | 
			
		||||
        return self.name or ""
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
class Origin(Base):
 | 
			
		||||
    """
 | 
			
		||||
    Represents a location which is the "origin" for some product(s).
 | 
			
		||||
    """
 | 
			
		||||
    __tablename__ = 'origins'
 | 
			
		||||
    __table_args__ = (
 | 
			
		||||
        sa.ForeignKeyConstraint(['countryID'], ['originCountry.countryID']),
 | 
			
		||||
        sa.ForeignKeyConstraint(['stateProvID'], ['originStateProv.stateProvID']),
 | 
			
		||||
        sa.ForeignKeyConstraint(['customID'], ['originCustomRegion.customID']),
 | 
			
		||||
    )
 | 
			
		||||
 | 
			
		||||
    id = sa.Column('originID', sa.Integer(), primary_key=True, autoincrement=True, nullable=False)
 | 
			
		||||
 | 
			
		||||
    country_id = sa.Column('countryID', sa.Integer(), nullable=True)
 | 
			
		||||
    country = orm.relationship(OriginCountry)
 | 
			
		||||
 | 
			
		||||
    state_prov_id = sa.Column('stateProvID', sa.Integer(), nullable=True)
 | 
			
		||||
    state_prov = orm.relationship(OriginStateProv)
 | 
			
		||||
 | 
			
		||||
    custom_id = sa.Column('customID', sa.Integer(), nullable=True)
 | 
			
		||||
    custom_region = orm.relationship(OriginCustomRegion)
 | 
			
		||||
 | 
			
		||||
    local = sa.Column(sa.Boolean(), nullable=True, default=0)
 | 
			
		||||
 | 
			
		||||
    name = sa.Column(sa.String(length=100), nullable=True)
 | 
			
		||||
 | 
			
		||||
    short_name = sa.Column('shortName', sa.String(length=50), nullable=True)
 | 
			
		||||
 | 
			
		||||
    def __str__(self):
 | 
			
		||||
        return self.name or self.short_name or ""
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
class Product(Base):
 | 
			
		||||
    """
 | 
			
		||||
    Represents a product, purchased and/or sold by the organization.
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue