Subversion Repositories SmartDukaan

Rev

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

Rev 5393 Rev 5424
Line 105... Line 105...
105
    @property
105
    @property
106
    def get_total_inventory(self):
106
    def get_total_inventory(self):
107
        if self.currentInventory:
107
        if self.currentInventory:
108
            i = 0
108
            i = 0
109
            for entry in self.currentInventory:
109
            for entry in self.currentInventory:
110
                i += entry.availibility
110
                i += entry.availability
111
            return i
111
            return i
112
        
112
        
113
        else:
113
        else:
114
            return 0;
114
            return 0;
115
    
115
    
Line 149... Line 149...
149
    using_table_options(mysql_engine="InnoDB")
149
    using_table_options(mysql_engine="InnoDB")
150
        
150
        
151
class CurrentInventorySnapshot(Entity):
151
class CurrentInventorySnapshot(Entity):
152
    item = ManyToOne("Item", primary_key=True)
152
    item = ManyToOne("Item", primary_key=True)
153
    warehouse = ManyToOne("Warehouse", primary_key=True)
153
    warehouse = ManyToOne("Warehouse", primary_key=True)
154
    availibility = Field(Integer)
154
    availability = Field(Integer)
155
    reserved = Field(Integer)
155
    reserved = Field(Integer)
156
    using_options(shortnames=True)
156
    using_options(shortnames=True)
157
    using_table_options(mysql_engine="InnoDB")
157
    using_table_options(mysql_engine="InnoDB")
158
    
158
    
159
    def __repr__(self):
159
    def __repr__(self):
160
        return "<current inventory><availability> %s </availability><time>%s</time><item>%s</item><warehouse>%s</warehouse></current inventory>" %(self.availibility, self.checkedOn, self.item, self.warehouse)
160
        return "<current inventory><availability> %s </availability><time>%s</time><item>%s</item><warehouse>%s</warehouse></current inventory>" %(self.availability, self.checkedOn, self.item, self.warehouse)
161
 
161
 
162
class BadInventorySnapshot(Entity):
162
class BadInventorySnapshot(Entity):
163
    item = ManyToOne("Item", primary_key=True)
163
    item = ManyToOne("Item", primary_key=True)
164
    warehouse = ManyToOne("Warehouse", primary_key=True)
164
    warehouse = ManyToOne("Warehouse", primary_key=True)
165
    availability = Field(Integer)
165
    availability = Field(Integer)
Line 167... Line 167...
167
    using_table_options(mysql_engine="InnoDB")
167
    using_table_options(mysql_engine="InnoDB")
168
 
168
 
169
class ItemInventoryHistory(Entity):
169
class ItemInventoryHistory(Entity):
170
    id = Field(Integer, primary_key=True, autoincrement = True)    
170
    id = Field(Integer, primary_key=True, autoincrement = True)    
171
    timestamp = Field(DateTime, default=datetime.datetime.now())
171
    timestamp = Field(DateTime, default=datetime.datetime.now())
172
    availibility = Field(Integer)
172
    availability = Field(Integer)
173
    item = ManyToOne("Item")
173
    item = ManyToOne("Item")
174
    warehouse = ManyToOne("Warehouse")
174
    warehouse = ManyToOne("Warehouse")
175
    using_options(shortnames=True)
175
    using_options(shortnames=True)
176
    using_table_options(mysql_engine="InnoDB")
176
    using_table_options(mysql_engine="InnoDB")
177
    
177