blob: a2cdefb6c5320a7b9b2f9120c7a2eaa61b95f862 [file] [log] [blame]
Rushabh Mehtae67d1fb2013-08-05 14:59:54 +05301# Copyright (c) 2013, Web Notes Technologies Pvt. Ltd.
2# License: GNU General Public License v3. See license.txt
3
Rushabh Mehtaed186b72013-07-30 16:19:40 +05304import webnotes, os
5webnotes.session = webnotes._dict({"user":"Administrator"})
6from core.page.data_import_tool.data_import_tool import upload
7
8def make():
9 webnotes.connect()
Rushabh Mehta2b76a5e2013-08-02 15:16:59 +053010 webnotes.print_messages = True
Rushabh Mehtaed186b72013-07-30 16:19:40 +053011 webnotes.mute_emails = True
12 install()
13 complete_setup()
14 make_items()
15 make_customers_suppliers_contacts()
16 # make_bom()
17 # make_opening_stock()
18 # make_opening_accounts()
19
20def install():
21 print "Creating Fresh Database..."
22 from webnotes.install_lib.install import Installer
23 inst = Installer('root')
24 inst.import_from_db("demo", verbose = 1)
25
26def complete_setup():
27 print "Complete Setup..."
28 webnotes.get_obj("Setup Control").setup_account({
29 "first_name": "Test",
30 "last_name": "User",
31 "fy_start": "1st Jan",
32 "industry": "Manufacturing",
33 "company_name": "Wind Power LLC",
34 "company_abbr": "WP",
35 "currency": "INR",
36 "timezone": "America/New York",
37 "country": "United States"
38 })
39
40def make_items():
41 print "Importing Items..."
42 webnotes.uploaded_file = os.path.join(os.path.dirname(__file__), "demo_docs", "Item.csv")
43 upload()
Rushabh Mehta2b76a5e2013-08-02 15:16:59 +053044 print "Importing Item Prices..."
45 webnotes.uploaded_file = os.path.join(os.path.dirname(__file__), "demo_docs", "Item_Price.csv")
46 upload()
Rushabh Mehtaed186b72013-07-30 16:19:40 +053047
48def make_customers_suppliers_contacts():
49 print "Importing Customers..."
50 webnotes.uploaded_file = os.path.join(os.path.dirname(__file__), "demo_docs", "Customer.csv")
51 upload()
52 print "Importing Suppliers..."
53 webnotes.uploaded_file = os.path.join(os.path.dirname(__file__), "demo_docs", "Supplier.csv")
54 upload()
55 print "Importing Contacts..."
56 webnotes.uploaded_file = os.path.join(os.path.dirname(__file__), "demo_docs", "Contact.csv")
57 upload()
58 print "Importing Address..."
59 webnotes.uploaded_file = os.path.join(os.path.dirname(__file__), "demo_docs", "Address.csv")
60 upload()
61 print "Importing Lead..."
62 webnotes.uploaded_file = os.path.join(os.path.dirname(__file__), "demo_docs", "Lead.csv")
63 upload()
64
65
66if __name__=="__main__":
67 make()