blob: 951aded84c0db73697519bd1bcd303df6214e452 [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()
Rushabh Mehta0b50b482013-08-06 17:53:41 +053016 make_users_and_employees()
Rushabh Mehtaed186b72013-07-30 16:19:40 +053017 # make_bom()
18 # make_opening_stock()
19 # make_opening_accounts()
20
21def install():
22 print "Creating Fresh Database..."
23 from webnotes.install_lib.install import Installer
24 inst = Installer('root')
25 inst.import_from_db("demo", verbose = 1)
26
27def complete_setup():
28 print "Complete Setup..."
29 webnotes.get_obj("Setup Control").setup_account({
30 "first_name": "Test",
31 "last_name": "User",
32 "fy_start": "1st Jan",
33 "industry": "Manufacturing",
34 "company_name": "Wind Power LLC",
35 "company_abbr": "WP",
Rushabh Mehta0b50b482013-08-06 17:53:41 +053036 "currency": "USD",
Rushabh Mehtaed186b72013-07-30 16:19:40 +053037 "timezone": "America/New York",
38 "country": "United States"
39 })
40
41def make_items():
42 print "Importing Items..."
43 webnotes.uploaded_file = os.path.join(os.path.dirname(__file__), "demo_docs", "Item.csv")
44 upload()
Rushabh Mehta2b76a5e2013-08-02 15:16:59 +053045 print "Importing Item Prices..."
46 webnotes.uploaded_file = os.path.join(os.path.dirname(__file__), "demo_docs", "Item_Price.csv")
47 upload()
Rushabh Mehtaed186b72013-07-30 16:19:40 +053048
49def make_customers_suppliers_contacts():
50 print "Importing Customers..."
51 webnotes.uploaded_file = os.path.join(os.path.dirname(__file__), "demo_docs", "Customer.csv")
52 upload()
53 print "Importing Suppliers..."
54 webnotes.uploaded_file = os.path.join(os.path.dirname(__file__), "demo_docs", "Supplier.csv")
55 upload()
56 print "Importing Contacts..."
57 webnotes.uploaded_file = os.path.join(os.path.dirname(__file__), "demo_docs", "Contact.csv")
58 upload()
59 print "Importing Address..."
60 webnotes.uploaded_file = os.path.join(os.path.dirname(__file__), "demo_docs", "Address.csv")
61 upload()
62 print "Importing Lead..."
63 webnotes.uploaded_file = os.path.join(os.path.dirname(__file__), "demo_docs", "Lead.csv")
64 upload()
65
Rushabh Mehta0b50b482013-08-06 17:53:41 +053066def make_users_and_employees():
67 print "Importing Profile..."
68 webnotes.uploaded_file = os.path.join(os.path.dirname(__file__), "demo_docs", "Profile.csv")
69 upload()
70 webnotes.conn.set_value("HR Settings", None, "emp_created_by", "Naming Series")
71 webnotes.conn.commit()
72
73 print "Importing Employee..."
74 webnotes.uploaded_file = os.path.join(os.path.dirname(__file__), "demo_docs", "Employee.csv")
75 upload()
76
77 print "Importing Salary Structure..."
78 webnotes.uploaded_file = os.path.join(os.path.dirname(__file__), "demo_docs", "Salary Structure.csv")
79 upload()
Rushabh Mehtaed186b72013-07-30 16:19:40 +053080
81if __name__=="__main__":
82 make()