Subversion Repositories SmartDukaan

Rev

Rev 6777 | Rev 6848 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 6777 Rev 6805
Line 56... Line 56...
56
    type = Field(Enum('SERIALIZED', 'NON_SERIALIZED'), default = 'NON_SERIALIZED', server_default='NON_SERIALIZED')
56
    type = Field(Enum('SERIALIZED', 'NON_SERIALIZED'), default = 'NON_SERIALIZED', server_default='NON_SERIALIZED')
57
    hasItemNo = Field(Boolean)
57
    hasItemNo = Field(Boolean)
58
    clearance = Field(Boolean)
58
    clearance = Field(Boolean)
59
    vatPercentage = Field(Float)
59
    vatPercentage = Field(Float)
60
    showSellingPrice = Field(Boolean)
60
    showSellingPrice = Field(Boolean)
-
 
61
    preferredInsurer = Field(Integer)
61
    using_options(shortnames=True)
62
    using_options(shortnames=True)
62
    using_table_options(mysql_engine="InnoDB")
63
    using_table_options(mysql_engine="InnoDB")
63
    
64
    
64
    def __repr__(self):
65
    def __repr__(self):
65
        return "<Item>%d</item>" % (self.id)
66
        return "<Item>%d</item>" % (self.id)
Line 146... Line 147...
146
    tag = Field(String(100),primary_key=True)
147
    tag = Field(String(100),primary_key=True)
147
    entityId = Field(Integer, primary_key=True, autoincrement=False)
148
    entityId = Field(Integer, primary_key=True, autoincrement=False)
148
    using_options(shortnames=True)
149
    using_options(shortnames=True)
149
    using_table_options(mysql_engine="InnoDB")
150
    using_table_options(mysql_engine="InnoDB")
150
        
151
        
-
 
152
class ItemInsurerMapping(Entity):
-
 
153
    id = Field(Integer, primary_key=True, autoincrement=True)
-
 
154
    itemId = Field(Integer)
-
 
155
    insurerId = Field(Integer)
-
 
156
    premiumType = Field(Integer)
-
 
157
    premiumAmount = Field(Float)
-
 
158
    using_options(shortnames=True)
-
 
159
    using_table_options(mysql_engine="InnoDB")
-
 
160
    
-
 
161
class Insurer(Entity):
-
 
162
    id = Field(Integer, primary_key=True, autoincrement=True)
-
 
163
    name = Field(String(255))
-
 
164
    address = Field(String(255))
-
 
165
    using_options(shortnames=True)
-
 
166
    using_table_options(mysql_engine="InnoDB")
-
 
167
    
151
def initialize(dbname='catalog', db_hostname="localhost"):
168
def initialize(dbname='catalog', db_hostname="localhost"):
152
    #metadata.bind = "sqlite:///inventory-new.sqlite" #need to read it from configserver.
169
    #metadata.bind = "sqlite:///inventory-new.sqlite" #need to read it from configserver.
153
    #metadata.bind = 'mysql://root:shop2020@localhost/catalog'
170
    #metadata.bind = 'mysql://root:shop2020@localhost/catalog'
154
    cengine = create_engine('mysql://root:shop2020@' + db_hostname + '/' + dbname, pool_recycle=7200)
171
    cengine = create_engine('mysql://root:shop2020@' + db_hostname + '/' + dbname, pool_recycle=7200)
155
    metadata.bind = cengine
172
    metadata.bind = cengine