Subversion Repositories SmartDukaan

Rev

Rev 21854 | Go to most recent revision | Details | Last modification | View Log | RSS feed

Rev Author Line No. Line
21847 amit.gupta 1
'''
2
Created on Jun 27, 2017
3
 
4
@author: amit
5
'''
6
from elixir import *
7
 
8
from shop2020.model.v1.order.impl.DataService import Seller, SellerWarehouse, \
9
    WarehouseAddressMaster, WarehouseAddressMapping, Organisation
10
import datetime
11
from shop2020.model.v1.order.impl import DataService
12
from shop2020.clients.TransactionClient import TransactionClient
13
from shop2020.clients.InventoryClient import InventoryClient
14
 
15
 
16
def create_delhi(company):
17
    # Create a seller for organisation which is specific to state - Delhi
18
    seller = Seller()
19
    warehouseId = 7573
20
    # registered address
21
    seller.address = 'Khasra No-322, Second Floor, Opp.Purani Tel Mil, Neb Sarai, New Delhi-110068'
22
    # keep one of , seller.gstn = '' or
23
    seller.tin = ''
24
    seller.gstin = 'DELGSTIN'
25
    # short for seller e.g. NSSPL-STATE
26
    seller.label = 'NSSPL-DL'
27
    seller.organisation_id = company.id
28
    # 0 for delhi, 1 MH, 2 karnataka, 3 Haryana, 4 Rajasthan, 5 Telangana, 6 Gujarat, 7 UP, 8, Punjab
29
    seller.state_id = 0
30
    session.merge(seller)
31
    # Create one warehouse for this seller 
32
    sellerWarehouse = SellerWarehouse()
33
    sellerWarehouse.created_on = datetime.datetime.now()
34
    sellerWarehouse.is_active = True
35
    # 0-B2C, 1-B2B
36
    sellerWarehouse.orderType = 0
37
    # Prefix that will be used during invoice generation at the time of billing.
38
    sellerWarehouse.prefix = 'NSDL'
39
    # This has to be created in old system and to be set accordingly
40
    sellerWarehouse.warehouse_id = warehouseId
41
    # The sequence of invoice in system is controlled from here.
42
    sellerWarehouse.id = 0
43
    sellerWarehouse.seller_id = seller.id
44
    session.merge(sellerWarehouse)
45
    # Lets Create one more warehouse for this seller for B2B purpose 
46
    #sellerWarehouse1 = SellerWarehouse()
47
    #sellerWarehouse1.created_on = datetime.datetime.now()
48
    #sellerWarehouse1.is_active = True
49
    # 0-B2C, 1-B2B
50
    #sellerWarehouse1.orderType = 1
51
    # Prefix that will be used during invoice generation at the time of billing.
52
    #sellerWarehouse1.prefix = 'NSDLBB'
53
    # This has to be created in old system and to be set accordingly
54
    #sellerWarehouse1.warehouse_id = warehouseId
55
    # The sequence of invoice in system is controlled from here.
56
    #sellerWarehouse1.id = 0
57
    #sellerWarehouse1.seller_id = seller.id
58
    #session.merge(sellerWarehouse1)
59
    # Create warehouse addresses
60
    whm1 = WarehouseAddressMaster()
61
    # complete address without pin
62
    whm1.address = 'Khasra No-322, Second Floor, Opp.Purani Tel Mil, Neb Sarai, New Delhi'
63
    whm1.pin = 110068
64
    whm1.created = datetime.datetime.now()
65
    # number of person responsible for warehouse
66
    whm1.contact_number = '9990381569'
67
    whm1.state_id = 0
68
    session.merge(whm1)
69
 
70
    warehouseAddressMapping = WarehouseAddressMapping()
71
    warehouseAddressMapping.address_id = whm1.id
72
    warehouseAddressMapping.created = datetime.datetime.now()
73
    warehouseAddressMapping.updated = datetime.datetime.now()
74
    warehouseAddressMapping.warehouse_id = warehouseId
75
    session.merge(warehouseAddressMapping)
76
 
77
def create_haryana(company):
78
    # Create a seller for organisation which is specific to state - Delhi
79
    warehouseId = 7441
80
    seller = Seller()
81
    # registered address
82
    seller.address = 'B/363-365, 2nd Floor, Opp Post Office, Part-2, Nehru Ground, NIT , Faridabad, Haryana-121001'
83
    # keep one of , seller.gstn = '' or
84
    seller.tin = ''
85
    seller.gstin = 'HRGSTIN'
86
    # short for seller e.g. NSSPL-STATE
87
    seller.label = 'NSSPL-HR'
88
    seller.organisation_id = company.id
89
    # 0 for delhi, 1 MH, 2 karnataka, 3 Haryana, 4 Rajasthan, 5 Telangana, 6 Gujarat, 7 UP, 8, Punjab
90
    seller.state_id = 3
91
    session.merge(seller)
92
    # Create one warehouse for this seller 
93
    sellerWarehouse = SellerWarehouse()
94
    sellerWarehouse.created_on = datetime.datetime.now()
95
    sellerWarehouse.is_active = True
96
    # 0-B2C, 1-B2B
97
    sellerWarehouse.orderType = 0
98
    # Prefix that will be used during invoice generation at the time of billing.
99
    sellerWarehouse.prefix = 'NSHRBC'
100
    # This has to be created in old system and to be set accordingly
101
    sellerWarehouse.warehouse_id = warehouseId
102
    # The sequence of invoice in system is controlled from here.
103
    sellerWarehouse.id = 0
104
    sellerWarehouse.seller_id = seller.id
105
    session.merge(sellerWarehouse)
106
    # Lets Create one one warehouse for this seller for B2B purpose 
107
    sellerWarehouse1 = SellerWarehouse()
108
    sellerWarehouse1.created_on = datetime.datetime.now()
109
    sellerWarehouse1.is_active = True
110
    # 0-B2C, 1-B2B
111
    sellerWarehouse1.orderType = 1
112
    # Prefix that will be used during invoice generation at the time of billing.
113
    sellerWarehouse1.prefix = 'NSHRBB'
114
    # This has to be created in old system and to be set accordingly
115
    sellerWarehouse1.warehouse_id = warehouseId
116
    # The sequence of invoice in system is controlled from here.
117
    sellerWarehouse1.id = 0
118
    sellerWarehouse1.seller_id = seller.id
119
    session.merge(sellerWarehouse1)
120
    # Create warehouse addresses
121
    whm1 = WarehouseAddressMaster()
122
    # complete address without pin
123
    whm1.address = 'B/363-365, 2nd Floor, Opp Post Office, Part-2, Nehru Ground, NIT , Faridabad, Haryana'
124
    whm1.pin = 121001
125
    whm1.created = datetime.datetime.now()
126
    # number of person responsible for warehouse
127
    whm1.contact_number = '9990381569'
128
    whm1.state_id = 0
129
    session.merge(whm1)
130
 
131
    warehouseAddressMapping = WarehouseAddressMapping()
132
    warehouseAddressMapping.address_id = whm1.id
133
    warehouseAddressMapping.created = datetime.datetime.now()
134
    warehouseAddressMapping.updated = datetime.datetime.now()
135
    warehouseAddressMapping.warehouse_id = warehouseId
136
 
137
 
138
 
139
def main():
140
    company = Organisation()
141
    company.name = 'New Spice Solutions Private Limited'
142
    company.address = 'Global Knowledge Park, 19A & 19B, 6th Floor, Sector 125, Noida, Uttar Pradesh - 201301'
143
    company.type = 'company'
144
    company.registered_id = 'U2222UP2009PTC036977'
145
    session.merge(company)
146
    create_delhi(company)
147
    #create_haryana(company)
148
    session.commit()
149
 
150
 
151
 
152
 
153
 
154
if __name__ == '__main__':
155
    #DataService.initialize()
156
    #main()
157
    tc = TransactionClient().get_client()
158
    print tc.getSellerInfo(12)