Subversion Repositories SmartDukaan

Rev

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

Rev 4295 Rev 4332
Line 7... Line 7...
7
import elixir
7
import elixir
8
from elixir.entity import Entity
8
from elixir.entity import Entity
9
from elixir.fields import Field
9
from elixir.fields import Field
10
from sqlalchemy.types import Integer, String, DateTime, Float, Boolean
10
from sqlalchemy.types import Integer, String, DateTime, Float, Boolean
11
from sqlalchemy import create_engine
11
from sqlalchemy import create_engine
12
from elixir.relationships import OneToMany, ManyToOne
12
from elixir.relationships import OneToMany, ManyToOne, ManyToMany
13
from elixir.options import using_options, using_table_options
13
from elixir.options import using_options, using_table_options
14
from elixir import metadata, setup_all
14
from elixir import metadata, setup_all
15
 
15
 
16
class Vendor(Entity):
16
class Vendor(Entity):
17
    id = Field(Integer, primary_key=True, autoincrement=True)
17
    id = Field(Integer, primary_key=True, autoincrement=True)
18
    name = Field(String(50))
18
    name = Field(String(50))
19
    warehouses = OneToMany('Warehouse')
19
    warehouses = ManyToMany('Warehouse')
20
    using_options(shortnames=True)
20
    using_options(shortnames=True)
21
    using_table_options(mysql_engine="InnoDB")
21
    using_table_options(mysql_engine="InnoDB")
22
 
22
 
23
class Warehouse(Entity):
23
class Warehouse(Entity):
24
    id = Field(Integer, primary_key=True, autoincrement=True)
24
    id = Field(Integer, primary_key=True, autoincrement=True)
Line 31... Line 31...
31
    pincode = Field(String(10))
31
    pincode = Field(String(10))
32
    vendorString = Field(String(50))
32
    vendorString = Field(String(50))
33
    inventory = OneToMany('CurrentInventorySnapshot')
33
    inventory = OneToMany('CurrentInventorySnapshot')
34
    inventoryHistory = OneToMany('ItemInventoryHistory')
34
    inventoryHistory = OneToMany('ItemInventoryHistory')
35
    logisticsLocation = Field(Integer)
35
    logisticsLocation = Field(Integer)
36
    vendor = ManyToOne('Vendor')
36
    vendors = ManyToMany('Vendor')
37
    billingType = Field(Integer)
37
    billingType = Field(Integer)
38
    using_options(shortnames=True)
38
    using_options(shortnames=True)
39
    using_table_options(mysql_engine="InnoDB")
39
    using_table_options(mysql_engine="InnoDB")
40
    
40
    
41
    def __repr__(self):
41
    def __repr__(self):