Rushabh Mehta | ed186b7 | 2013-07-30 16:19:40 +0530 | [diff] [blame] | 1 | import webnotes, os |
| 2 | webnotes.session = webnotes._dict({"user":"Administrator"}) |
| 3 | from core.page.data_import_tool.data_import_tool import upload |
| 4 | |
| 5 | def make(): |
| 6 | webnotes.connect() |
| 7 | webnotes.mute_emails = True |
| 8 | install() |
| 9 | complete_setup() |
| 10 | make_items() |
| 11 | make_customers_suppliers_contacts() |
| 12 | # make_bom() |
| 13 | # make_opening_stock() |
| 14 | # make_opening_accounts() |
| 15 | |
| 16 | def install(): |
| 17 | print "Creating Fresh Database..." |
| 18 | from webnotes.install_lib.install import Installer |
| 19 | inst = Installer('root') |
| 20 | inst.import_from_db("demo", verbose = 1) |
| 21 | |
| 22 | def complete_setup(): |
| 23 | print "Complete Setup..." |
| 24 | webnotes.get_obj("Setup Control").setup_account({ |
| 25 | "first_name": "Test", |
| 26 | "last_name": "User", |
| 27 | "fy_start": "1st Jan", |
| 28 | "industry": "Manufacturing", |
| 29 | "company_name": "Wind Power LLC", |
| 30 | "company_abbr": "WP", |
| 31 | "currency": "INR", |
| 32 | "timezone": "America/New York", |
| 33 | "country": "United States" |
| 34 | }) |
| 35 | |
| 36 | def make_items(): |
| 37 | print "Importing Items..." |
| 38 | webnotes.uploaded_file = os.path.join(os.path.dirname(__file__), "demo_docs", "Item.csv") |
| 39 | upload() |
| 40 | |
| 41 | def make_customers_suppliers_contacts(): |
| 42 | print "Importing Customers..." |
| 43 | webnotes.uploaded_file = os.path.join(os.path.dirname(__file__), "demo_docs", "Customer.csv") |
| 44 | upload() |
| 45 | print "Importing Suppliers..." |
| 46 | webnotes.uploaded_file = os.path.join(os.path.dirname(__file__), "demo_docs", "Supplier.csv") |
| 47 | upload() |
| 48 | print "Importing Contacts..." |
| 49 | webnotes.uploaded_file = os.path.join(os.path.dirname(__file__), "demo_docs", "Contact.csv") |
| 50 | upload() |
| 51 | print "Importing Address..." |
| 52 | webnotes.uploaded_file = os.path.join(os.path.dirname(__file__), "demo_docs", "Address.csv") |
| 53 | upload() |
| 54 | print "Importing Lead..." |
| 55 | webnotes.uploaded_file = os.path.join(os.path.dirname(__file__), "demo_docs", "Lead.csv") |
| 56 | upload() |
| 57 | |
| 58 | |
| 59 | if __name__=="__main__": |
| 60 | make() |