mirror of
https://github.com/frappe/erpnext.git
synced 2026-09-17 10:36:31 +00:00
Merge branch 'develop' into payment-terms
This commit is contained in:
@@ -195,6 +195,157 @@
|
||||
"set_only_once": 0,
|
||||
"unique": 0
|
||||
},
|
||||
{
|
||||
"allow_bulk_edit": 0,
|
||||
"allow_on_submit": 0,
|
||||
"bold": 0,
|
||||
"collapsible": 0,
|
||||
"columns": 0,
|
||||
"fieldname": "sales_settings",
|
||||
"fieldtype": "Section Break",
|
||||
"hidden": 0,
|
||||
"ignore_user_permissions": 0,
|
||||
"ignore_xss_filter": 0,
|
||||
"in_filter": 0,
|
||||
"in_global_search": 0,
|
||||
"in_list_view": 0,
|
||||
"in_standard_filter": 0,
|
||||
"label": "Sales",
|
||||
"length": 0,
|
||||
"no_copy": 0,
|
||||
"permlevel": 0,
|
||||
"precision": "",
|
||||
"print_hide": 0,
|
||||
"print_hide_if_no_value": 0,
|
||||
"read_only": 0,
|
||||
"remember_last_selected_value": 0,
|
||||
"report_hide": 0,
|
||||
"reqd": 0,
|
||||
"search_index": 0,
|
||||
"set_only_once": 0,
|
||||
"unique": 0
|
||||
},
|
||||
{
|
||||
"allow_bulk_edit": 0,
|
||||
"allow_on_submit": 0,
|
||||
"bold": 0,
|
||||
"collapsible": 0,
|
||||
"columns": 0,
|
||||
"fieldname": "sales_monthly_history",
|
||||
"fieldtype": "Small Text",
|
||||
"hidden": 1,
|
||||
"ignore_user_permissions": 0,
|
||||
"ignore_xss_filter": 0,
|
||||
"in_filter": 0,
|
||||
"in_global_search": 0,
|
||||
"in_list_view": 0,
|
||||
"in_standard_filter": 0,
|
||||
"label": "Sales Monthly History",
|
||||
"length": 0,
|
||||
"no_copy": 1,
|
||||
"permlevel": 0,
|
||||
"precision": "",
|
||||
"print_hide": 0,
|
||||
"print_hide_if_no_value": 0,
|
||||
"read_only": 1,
|
||||
"remember_last_selected_value": 0,
|
||||
"report_hide": 0,
|
||||
"reqd": 0,
|
||||
"search_index": 0,
|
||||
"set_only_once": 0,
|
||||
"unique": 0
|
||||
},
|
||||
{
|
||||
"allow_bulk_edit": 0,
|
||||
"allow_on_submit": 0,
|
||||
"bold": 0,
|
||||
"collapsible": 0,
|
||||
"columns": 0,
|
||||
"fieldname": "monthly_sales_target",
|
||||
"fieldtype": "Currency",
|
||||
"hidden": 0,
|
||||
"ignore_user_permissions": 0,
|
||||
"ignore_xss_filter": 0,
|
||||
"in_filter": 0,
|
||||
"in_global_search": 0,
|
||||
"in_list_view": 0,
|
||||
"in_standard_filter": 0,
|
||||
"label": "Monthly Sales Target",
|
||||
"length": 0,
|
||||
"no_copy": 0,
|
||||
"options": "default_currency",
|
||||
"permlevel": 0,
|
||||
"precision": "",
|
||||
"print_hide": 0,
|
||||
"print_hide_if_no_value": 0,
|
||||
"read_only": 0,
|
||||
"remember_last_selected_value": 0,
|
||||
"report_hide": 0,
|
||||
"reqd": 0,
|
||||
"search_index": 0,
|
||||
"set_only_once": 0,
|
||||
"unique": 0
|
||||
},
|
||||
{
|
||||
"allow_bulk_edit": 0,
|
||||
"allow_on_submit": 0,
|
||||
"bold": 0,
|
||||
"collapsible": 0,
|
||||
"columns": 0,
|
||||
"fieldname": "column_break_goals",
|
||||
"fieldtype": "Column Break",
|
||||
"hidden": 0,
|
||||
"ignore_user_permissions": 0,
|
||||
"ignore_xss_filter": 0,
|
||||
"in_filter": 0,
|
||||
"in_global_search": 0,
|
||||
"in_list_view": 0,
|
||||
"in_standard_filter": 0,
|
||||
"length": 0,
|
||||
"no_copy": 0,
|
||||
"permlevel": 0,
|
||||
"precision": "",
|
||||
"print_hide": 0,
|
||||
"print_hide_if_no_value": 0,
|
||||
"read_only": 0,
|
||||
"remember_last_selected_value": 0,
|
||||
"report_hide": 0,
|
||||
"reqd": 0,
|
||||
"search_index": 0,
|
||||
"set_only_once": 0,
|
||||
"unique": 0
|
||||
},
|
||||
{
|
||||
"allow_bulk_edit": 0,
|
||||
"allow_on_submit": 0,
|
||||
"bold": 0,
|
||||
"collapsible": 0,
|
||||
"columns": 0,
|
||||
"fieldname": "total_monthly_sales",
|
||||
"fieldtype": "Currency",
|
||||
"hidden": 0,
|
||||
"ignore_user_permissions": 0,
|
||||
"ignore_xss_filter": 0,
|
||||
"in_filter": 0,
|
||||
"in_global_search": 0,
|
||||
"in_list_view": 0,
|
||||
"in_standard_filter": 0,
|
||||
"label": "Total Monthly Sales",
|
||||
"length": 0,
|
||||
"no_copy": 1,
|
||||
"options": "default_currency",
|
||||
"permlevel": 0,
|
||||
"precision": "",
|
||||
"print_hide": 0,
|
||||
"print_hide_if_no_value": 0,
|
||||
"read_only": 1,
|
||||
"remember_last_selected_value": 0,
|
||||
"report_hide": 0,
|
||||
"reqd": 0,
|
||||
"search_index": 0,
|
||||
"set_only_once": 0,
|
||||
"unique": 0
|
||||
},
|
||||
{
|
||||
"allow_bulk_edit": 0,
|
||||
"allow_on_submit": 0,
|
||||
@@ -500,157 +651,6 @@
|
||||
"set_only_once": 0,
|
||||
"unique": 0
|
||||
},
|
||||
{
|
||||
"allow_bulk_edit": 0,
|
||||
"allow_on_submit": 0,
|
||||
"bold": 0,
|
||||
"collapsible": 0,
|
||||
"columns": 0,
|
||||
"fieldname": "sales_settings",
|
||||
"fieldtype": "Section Break",
|
||||
"hidden": 0,
|
||||
"ignore_user_permissions": 0,
|
||||
"ignore_xss_filter": 0,
|
||||
"in_filter": 0,
|
||||
"in_global_search": 0,
|
||||
"in_list_view": 0,
|
||||
"in_standard_filter": 0,
|
||||
"label": "Sales",
|
||||
"length": 0,
|
||||
"no_copy": 0,
|
||||
"permlevel": 0,
|
||||
"precision": "",
|
||||
"print_hide": 0,
|
||||
"print_hide_if_no_value": 0,
|
||||
"read_only": 0,
|
||||
"remember_last_selected_value": 0,
|
||||
"report_hide": 0,
|
||||
"reqd": 0,
|
||||
"search_index": 0,
|
||||
"set_only_once": 0,
|
||||
"unique": 0
|
||||
},
|
||||
{
|
||||
"allow_bulk_edit": 0,
|
||||
"allow_on_submit": 0,
|
||||
"bold": 0,
|
||||
"collapsible": 0,
|
||||
"columns": 0,
|
||||
"fieldname": "sales_monthly_history",
|
||||
"fieldtype": "Small Text",
|
||||
"hidden": 1,
|
||||
"ignore_user_permissions": 0,
|
||||
"ignore_xss_filter": 0,
|
||||
"in_filter": 0,
|
||||
"in_global_search": 0,
|
||||
"in_list_view": 0,
|
||||
"in_standard_filter": 0,
|
||||
"label": "Sales Monthly History",
|
||||
"length": 0,
|
||||
"no_copy": 1,
|
||||
"permlevel": 0,
|
||||
"precision": "",
|
||||
"print_hide": 0,
|
||||
"print_hide_if_no_value": 0,
|
||||
"read_only": 1,
|
||||
"remember_last_selected_value": 0,
|
||||
"report_hide": 0,
|
||||
"reqd": 0,
|
||||
"search_index": 0,
|
||||
"set_only_once": 0,
|
||||
"unique": 0
|
||||
},
|
||||
{
|
||||
"allow_bulk_edit": 0,
|
||||
"allow_on_submit": 0,
|
||||
"bold": 0,
|
||||
"collapsible": 0,
|
||||
"columns": 0,
|
||||
"fieldname": "sales_target",
|
||||
"fieldtype": "Currency",
|
||||
"hidden": 0,
|
||||
"ignore_user_permissions": 0,
|
||||
"ignore_xss_filter": 0,
|
||||
"in_filter": 0,
|
||||
"in_global_search": 0,
|
||||
"in_list_view": 0,
|
||||
"in_standard_filter": 0,
|
||||
"label": "Sales Target",
|
||||
"length": 0,
|
||||
"no_copy": 1,
|
||||
"options": "default_currency",
|
||||
"permlevel": 0,
|
||||
"precision": "",
|
||||
"print_hide": 0,
|
||||
"print_hide_if_no_value": 0,
|
||||
"read_only": 0,
|
||||
"remember_last_selected_value": 0,
|
||||
"report_hide": 0,
|
||||
"reqd": 0,
|
||||
"search_index": 0,
|
||||
"set_only_once": 0,
|
||||
"unique": 0
|
||||
},
|
||||
{
|
||||
"allow_bulk_edit": 0,
|
||||
"allow_on_submit": 0,
|
||||
"bold": 0,
|
||||
"collapsible": 0,
|
||||
"columns": 0,
|
||||
"fieldname": "column_break_goals",
|
||||
"fieldtype": "Column Break",
|
||||
"hidden": 0,
|
||||
"ignore_user_permissions": 0,
|
||||
"ignore_xss_filter": 0,
|
||||
"in_filter": 0,
|
||||
"in_global_search": 0,
|
||||
"in_list_view": 0,
|
||||
"in_standard_filter": 0,
|
||||
"length": 0,
|
||||
"no_copy": 0,
|
||||
"permlevel": 0,
|
||||
"precision": "",
|
||||
"print_hide": 0,
|
||||
"print_hide_if_no_value": 0,
|
||||
"read_only": 0,
|
||||
"remember_last_selected_value": 0,
|
||||
"report_hide": 0,
|
||||
"reqd": 0,
|
||||
"search_index": 0,
|
||||
"set_only_once": 0,
|
||||
"unique": 0
|
||||
},
|
||||
{
|
||||
"allow_bulk_edit": 0,
|
||||
"allow_on_submit": 0,
|
||||
"bold": 0,
|
||||
"collapsible": 0,
|
||||
"columns": 0,
|
||||
"fieldname": "total_monthly_sales",
|
||||
"fieldtype": "Currency",
|
||||
"hidden": 0,
|
||||
"ignore_user_permissions": 0,
|
||||
"ignore_xss_filter": 0,
|
||||
"in_filter": 0,
|
||||
"in_global_search": 0,
|
||||
"in_list_view": 0,
|
||||
"in_standard_filter": 0,
|
||||
"label": "Total Monthly Sales",
|
||||
"length": 0,
|
||||
"no_copy": 1,
|
||||
"options": "default_currency",
|
||||
"permlevel": 0,
|
||||
"precision": "",
|
||||
"print_hide": 0,
|
||||
"print_hide_if_no_value": 0,
|
||||
"read_only": 1,
|
||||
"remember_last_selected_value": 0,
|
||||
"report_hide": 0,
|
||||
"reqd": 0,
|
||||
"search_index": 0,
|
||||
"set_only_once": 0,
|
||||
"unique": 0
|
||||
},
|
||||
{
|
||||
"allow_bulk_edit": 0,
|
||||
"allow_on_submit": 0,
|
||||
@@ -1991,7 +1991,7 @@
|
||||
"istable": 0,
|
||||
"max_attachments": 0,
|
||||
"menu_index": 0,
|
||||
"modified": "2017-08-03 16:17:31.206886",
|
||||
"modified": "2017-08-31 11:48:56.278568",
|
||||
"modified_by": "Administrator",
|
||||
"module": "Setup",
|
||||
"name": "Company",
|
||||
|
||||
@@ -76,7 +76,10 @@ class Company(Document):
|
||||
self.create_default_accounts()
|
||||
self.create_default_warehouses()
|
||||
|
||||
self.install_country_fixtures()
|
||||
if cint(frappe.db.get_single_value('System Settings', 'setup_complete')):
|
||||
# In the case of setup, fixtures should be installed after setup_success
|
||||
# This also prevents db commits before setup is successful
|
||||
install_country_fixtures(self.name)
|
||||
|
||||
if not frappe.db.get_value("Cost Center", {"is_group": 0, "company": self.name}):
|
||||
self.create_default_cost_center()
|
||||
@@ -95,12 +98,6 @@ class Company(Document):
|
||||
|
||||
frappe.clear_cache()
|
||||
|
||||
def install_country_fixtures(self):
|
||||
path = frappe.get_app_path('erpnext', 'regional', frappe.scrub(self.country))
|
||||
if os.path.exists(path.encode("utf-8")):
|
||||
frappe.get_attr("erpnext.regional.{0}.setup.setup"
|
||||
.format(self.country.lower()))(self)
|
||||
|
||||
def create_default_warehouses(self):
|
||||
for wh_detail in [
|
||||
{"warehouse_name": _("All Warehouses"), "is_group": 1},
|
||||
@@ -311,6 +308,13 @@ def get_name_with_abbr(name, company):
|
||||
|
||||
return " - ".join(parts)
|
||||
|
||||
def install_country_fixtures(company):
|
||||
company_doc = frappe.get_doc("Company", company)
|
||||
path = frappe.get_app_path('erpnext', 'regional', frappe.scrub(company_doc.country))
|
||||
if os.path.exists(path.encode("utf-8")):
|
||||
frappe.get_attr("erpnext.regional.{0}.setup.setup"
|
||||
.format(company_doc.country.lower()))(company_doc)
|
||||
|
||||
def update_company_current_month_sales(company):
|
||||
current_month_year = formatdate(today(), "MM-yyyy")
|
||||
|
||||
|
||||
@@ -9,7 +9,7 @@ def get_data():
|
||||
'graph_method': "frappe.utils.goal.get_monthly_goal_graph_data",
|
||||
'graph_method_args': {
|
||||
'title': 'Sales',
|
||||
'goal_value_field': 'sales_target',
|
||||
'goal_value_field': 'monthly_sales_target',
|
||||
'goal_total_field': 'total_monthly_sales',
|
||||
'goal_history_field': 'sales_monthly_history',
|
||||
'goal_doctype': 'Sales Invoice',
|
||||
|
||||
0
erpnext/setup/doctype/setup_progress/__init__.py
Normal file
0
erpnext/setup/doctype/setup_progress/__init__.py
Normal file
8
erpnext/setup/doctype/setup_progress/setup_progress.js
Normal file
8
erpnext/setup/doctype/setup_progress/setup_progress.js
Normal file
@@ -0,0 +1,8 @@
|
||||
// Copyright (c) 2017, Frappe Technologies Pvt. Ltd. and contributors
|
||||
// For license information, please see license.txt
|
||||
|
||||
frappe.ui.form.on('Setup Progress', {
|
||||
refresh: function() {
|
||||
|
||||
}
|
||||
});
|
||||
123
erpnext/setup/doctype/setup_progress/setup_progress.json
Normal file
123
erpnext/setup/doctype/setup_progress/setup_progress.json
Normal file
@@ -0,0 +1,123 @@
|
||||
{
|
||||
"allow_copy": 0,
|
||||
"allow_guest_to_view": 0,
|
||||
"allow_import": 0,
|
||||
"allow_rename": 0,
|
||||
"beta": 0,
|
||||
"creation": "2017-08-27 21:01:42.032109",
|
||||
"custom": 0,
|
||||
"docstatus": 0,
|
||||
"doctype": "DocType",
|
||||
"document_type": "",
|
||||
"editable_grid": 1,
|
||||
"engine": "InnoDB",
|
||||
"fields": [
|
||||
{
|
||||
"allow_bulk_edit": 0,
|
||||
"allow_on_submit": 0,
|
||||
"bold": 0,
|
||||
"collapsible": 0,
|
||||
"columns": 0,
|
||||
"fieldname": "actions_sb",
|
||||
"fieldtype": "Section Break",
|
||||
"hidden": 0,
|
||||
"ignore_user_permissions": 0,
|
||||
"ignore_xss_filter": 0,
|
||||
"in_filter": 0,
|
||||
"in_global_search": 0,
|
||||
"in_list_view": 0,
|
||||
"in_standard_filter": 0,
|
||||
"label": "Actions",
|
||||
"length": 0,
|
||||
"no_copy": 0,
|
||||
"permlevel": 0,
|
||||
"precision": "",
|
||||
"print_hide": 0,
|
||||
"print_hide_if_no_value": 0,
|
||||
"read_only": 0,
|
||||
"remember_last_selected_value": 0,
|
||||
"report_hide": 0,
|
||||
"reqd": 0,
|
||||
"search_index": 0,
|
||||
"set_only_once": 0,
|
||||
"unique": 0
|
||||
},
|
||||
{
|
||||
"allow_bulk_edit": 0,
|
||||
"allow_on_submit": 0,
|
||||
"bold": 0,
|
||||
"collapsible": 0,
|
||||
"columns": 0,
|
||||
"fieldname": "actions",
|
||||
"fieldtype": "Table",
|
||||
"hidden": 0,
|
||||
"ignore_user_permissions": 0,
|
||||
"ignore_xss_filter": 0,
|
||||
"in_filter": 0,
|
||||
"in_global_search": 0,
|
||||
"in_list_view": 0,
|
||||
"in_standard_filter": 0,
|
||||
"label": "Actions",
|
||||
"length": 0,
|
||||
"no_copy": 0,
|
||||
"options": "Setup Progress Action",
|
||||
"permlevel": 0,
|
||||
"precision": "",
|
||||
"print_hide": 0,
|
||||
"print_hide_if_no_value": 0,
|
||||
"read_only": 0,
|
||||
"remember_last_selected_value": 0,
|
||||
"report_hide": 0,
|
||||
"reqd": 0,
|
||||
"search_index": 0,
|
||||
"set_only_once": 0,
|
||||
"unique": 0
|
||||
}
|
||||
],
|
||||
"has_web_view": 0,
|
||||
"hide_heading": 0,
|
||||
"hide_toolbar": 0,
|
||||
"idx": 0,
|
||||
"image_view": 0,
|
||||
"in_create": 1,
|
||||
"is_submittable": 0,
|
||||
"issingle": 1,
|
||||
"istable": 0,
|
||||
"max_attachments": 0,
|
||||
"modified": "2017-08-28 17:44:43.100932",
|
||||
"modified_by": "Administrator",
|
||||
"module": "Setup",
|
||||
"name": "Setup Progress",
|
||||
"name_case": "",
|
||||
"owner": "Administrator",
|
||||
"permissions": [
|
||||
{
|
||||
"amend": 0,
|
||||
"apply_user_permissions": 0,
|
||||
"cancel": 0,
|
||||
"create": 1,
|
||||
"delete": 1,
|
||||
"email": 1,
|
||||
"export": 0,
|
||||
"if_owner": 0,
|
||||
"import": 0,
|
||||
"permlevel": 0,
|
||||
"print": 1,
|
||||
"read": 1,
|
||||
"report": 0,
|
||||
"role": "System Manager",
|
||||
"set_user_permissions": 0,
|
||||
"share": 1,
|
||||
"submit": 0,
|
||||
"write": 1
|
||||
}
|
||||
],
|
||||
"quick_entry": 1,
|
||||
"read_only": 1,
|
||||
"read_only_onload": 0,
|
||||
"show_name_in_global_search": 0,
|
||||
"sort_field": "modified",
|
||||
"sort_order": "DESC",
|
||||
"track_changes": 1,
|
||||
"track_seen": 0
|
||||
}
|
||||
51
erpnext/setup/doctype/setup_progress/setup_progress.py
Normal file
51
erpnext/setup/doctype/setup_progress/setup_progress.py
Normal file
@@ -0,0 +1,51 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
# Copyright (c) 2017, Frappe Technologies Pvt. Ltd. and contributors
|
||||
# For license information, please see license.txt
|
||||
|
||||
from __future__ import unicode_literals
|
||||
import frappe, json
|
||||
from frappe.model.document import Document
|
||||
|
||||
class SetupProgress(Document):
|
||||
pass
|
||||
|
||||
def get_setup_progress():
|
||||
if not getattr(frappe.local, "setup_progress", None):
|
||||
frappe.local.setup_progress = frappe.get_doc("Setup Progress", "Setup Progress")
|
||||
|
||||
return frappe.local.setup_progress
|
||||
|
||||
def get_action_completed_state(action_name):
|
||||
return [d.is_completed for d in get_setup_progress().actions
|
||||
if d.action_name == action_name][0]
|
||||
|
||||
def update_action_completed_state(action_name):
|
||||
action_table_doc = [d for d in get_setup_progress().actions
|
||||
if d.action_name == action_name][0]
|
||||
update_action(action_table_doc)
|
||||
|
||||
def update_action(action_table_doc):
|
||||
if not action_table_doc.is_completed and frappe.db.count(action_table_doc.action_doctype) >= action_table_doc.min_doc_count:
|
||||
action_table_doc.is_completed = 1
|
||||
action_table_doc.save()
|
||||
|
||||
def update_domain_actions(domain):
|
||||
for d in get_setup_progress().actions:
|
||||
domains = json.loads(d.domains)
|
||||
if domains == [] or domain in domains:
|
||||
update_action(d)
|
||||
|
||||
def get_domain_actions_state(domain):
|
||||
state = {}
|
||||
for d in get_setup_progress().actions:
|
||||
domains = json.loads(d.domains)
|
||||
if domains == [] or domain in domains:
|
||||
state[d.action_name] = d.is_completed
|
||||
return state
|
||||
|
||||
@frappe.whitelist()
|
||||
def set_action_completed_state(action_name):
|
||||
action_table_doc = [d for d in get_setup_progress().actions
|
||||
if d.action_name == action_name][0]
|
||||
action_table_doc.is_completed = 1
|
||||
action_table_doc.save()
|
||||
23
erpnext/setup/doctype/setup_progress/test_setup_progress.js
Normal file
23
erpnext/setup/doctype/setup_progress/test_setup_progress.js
Normal file
@@ -0,0 +1,23 @@
|
||||
/* eslint-disable */
|
||||
// rename this file from _test_[name] to test_[name] to activate
|
||||
// and remove above this line
|
||||
|
||||
QUnit.test("test: Setup Progress", function (assert) {
|
||||
let done = assert.async();
|
||||
|
||||
// number of asserts
|
||||
assert.expect(1);
|
||||
|
||||
frappe.run_serially([
|
||||
// insert a new Setup Progress
|
||||
() => frappe.tests.make('Setup Progress', [
|
||||
// values to be set
|
||||
{key: 'value'}
|
||||
]),
|
||||
() => {
|
||||
assert.equal(cur_frm.doc.key, 'value');
|
||||
},
|
||||
() => done()
|
||||
]);
|
||||
|
||||
});
|
||||
@@ -0,0 +1,192 @@
|
||||
{
|
||||
"allow_copy": 0,
|
||||
"allow_guest_to_view": 0,
|
||||
"allow_import": 0,
|
||||
"allow_rename": 0,
|
||||
"beta": 0,
|
||||
"creation": "2017-08-27 21:00:40.715360",
|
||||
"custom": 0,
|
||||
"docstatus": 0,
|
||||
"doctype": "DocType",
|
||||
"document_type": "",
|
||||
"editable_grid": 1,
|
||||
"engine": "InnoDB",
|
||||
"fields": [
|
||||
{
|
||||
"allow_bulk_edit": 0,
|
||||
"allow_on_submit": 0,
|
||||
"bold": 0,
|
||||
"collapsible": 0,
|
||||
"columns": 0,
|
||||
"fieldname": "action_name",
|
||||
"fieldtype": "Data",
|
||||
"hidden": 0,
|
||||
"ignore_user_permissions": 0,
|
||||
"ignore_xss_filter": 0,
|
||||
"in_filter": 0,
|
||||
"in_global_search": 0,
|
||||
"in_list_view": 1,
|
||||
"in_standard_filter": 0,
|
||||
"label": "Action Name",
|
||||
"length": 0,
|
||||
"no_copy": 0,
|
||||
"permlevel": 0,
|
||||
"precision": "",
|
||||
"print_hide": 0,
|
||||
"print_hide_if_no_value": 0,
|
||||
"read_only": 0,
|
||||
"remember_last_selected_value": 0,
|
||||
"report_hide": 0,
|
||||
"reqd": 1,
|
||||
"search_index": 0,
|
||||
"set_only_once": 0,
|
||||
"unique": 0
|
||||
},
|
||||
{
|
||||
"allow_bulk_edit": 0,
|
||||
"allow_on_submit": 0,
|
||||
"bold": 0,
|
||||
"collapsible": 0,
|
||||
"columns": 0,
|
||||
"fieldname": "action_doctype",
|
||||
"fieldtype": "Link",
|
||||
"hidden": 0,
|
||||
"ignore_user_permissions": 0,
|
||||
"ignore_xss_filter": 0,
|
||||
"in_filter": 0,
|
||||
"in_global_search": 0,
|
||||
"in_list_view": 1,
|
||||
"in_standard_filter": 0,
|
||||
"label": "Action Doctype",
|
||||
"length": 0,
|
||||
"no_copy": 0,
|
||||
"options": "DocType",
|
||||
"permlevel": 0,
|
||||
"precision": "",
|
||||
"print_hide": 0,
|
||||
"print_hide_if_no_value": 0,
|
||||
"read_only": 0,
|
||||
"remember_last_selected_value": 0,
|
||||
"report_hide": 0,
|
||||
"reqd": 0,
|
||||
"search_index": 0,
|
||||
"set_only_once": 0,
|
||||
"unique": 0
|
||||
},
|
||||
{
|
||||
"allow_bulk_edit": 0,
|
||||
"allow_on_submit": 0,
|
||||
"bold": 0,
|
||||
"collapsible": 0,
|
||||
"columns": 0,
|
||||
"fieldname": "min_doc_count",
|
||||
"fieldtype": "Int",
|
||||
"hidden": 0,
|
||||
"ignore_user_permissions": 0,
|
||||
"ignore_xss_filter": 0,
|
||||
"in_filter": 0,
|
||||
"in_global_search": 0,
|
||||
"in_list_view": 1,
|
||||
"in_standard_filter": 0,
|
||||
"label": "Min Doc Count",
|
||||
"length": 0,
|
||||
"no_copy": 0,
|
||||
"permlevel": 0,
|
||||
"precision": "",
|
||||
"print_hide": 0,
|
||||
"print_hide_if_no_value": 0,
|
||||
"read_only": 0,
|
||||
"remember_last_selected_value": 0,
|
||||
"report_hide": 0,
|
||||
"reqd": 0,
|
||||
"search_index": 0,
|
||||
"set_only_once": 0,
|
||||
"unique": 0
|
||||
},
|
||||
{
|
||||
"allow_bulk_edit": 0,
|
||||
"allow_on_submit": 0,
|
||||
"bold": 0,
|
||||
"collapsible": 0,
|
||||
"columns": 0,
|
||||
"fieldname": "domains",
|
||||
"fieldtype": "Code",
|
||||
"hidden": 0,
|
||||
"ignore_user_permissions": 0,
|
||||
"ignore_xss_filter": 0,
|
||||
"in_filter": 0,
|
||||
"in_global_search": 0,
|
||||
"in_list_view": 1,
|
||||
"in_standard_filter": 0,
|
||||
"label": "Domains",
|
||||
"length": 0,
|
||||
"no_copy": 0,
|
||||
"permlevel": 0,
|
||||
"precision": "",
|
||||
"print_hide": 0,
|
||||
"print_hide_if_no_value": 0,
|
||||
"read_only": 0,
|
||||
"remember_last_selected_value": 0,
|
||||
"report_hide": 0,
|
||||
"reqd": 0,
|
||||
"search_index": 0,
|
||||
"set_only_once": 0,
|
||||
"unique": 0
|
||||
},
|
||||
{
|
||||
"allow_bulk_edit": 0,
|
||||
"allow_on_submit": 0,
|
||||
"bold": 0,
|
||||
"collapsible": 0,
|
||||
"columns": 0,
|
||||
"fieldname": "is_completed",
|
||||
"fieldtype": "Check",
|
||||
"hidden": 0,
|
||||
"ignore_user_permissions": 0,
|
||||
"ignore_xss_filter": 0,
|
||||
"in_filter": 0,
|
||||
"in_global_search": 0,
|
||||
"in_list_view": 1,
|
||||
"in_standard_filter": 0,
|
||||
"label": "Is Completed",
|
||||
"length": 0,
|
||||
"no_copy": 0,
|
||||
"permlevel": 0,
|
||||
"precision": "",
|
||||
"print_hide": 0,
|
||||
"print_hide_if_no_value": 0,
|
||||
"read_only": 0,
|
||||
"remember_last_selected_value": 0,
|
||||
"report_hide": 0,
|
||||
"reqd": 0,
|
||||
"search_index": 0,
|
||||
"set_only_once": 0,
|
||||
"unique": 0
|
||||
}
|
||||
],
|
||||
"has_web_view": 0,
|
||||
"hide_heading": 0,
|
||||
"hide_toolbar": 0,
|
||||
"idx": 0,
|
||||
"image_view": 0,
|
||||
"in_create": 1,
|
||||
"is_submittable": 0,
|
||||
"issingle": 0,
|
||||
"istable": 1,
|
||||
"max_attachments": 0,
|
||||
"modified": "2017-08-28 17:44:58.008526",
|
||||
"modified_by": "Administrator",
|
||||
"module": "Setup",
|
||||
"name": "Setup Progress Action",
|
||||
"name_case": "",
|
||||
"owner": "Administrator",
|
||||
"permissions": [],
|
||||
"quick_entry": 1,
|
||||
"read_only": 1,
|
||||
"read_only_onload": 0,
|
||||
"show_name_in_global_search": 0,
|
||||
"sort_field": "modified",
|
||||
"sort_order": "DESC",
|
||||
"track_changes": 1,
|
||||
"track_seen": 0
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
# Copyright (c) 2017, Frappe Technologies Pvt. Ltd. and contributors
|
||||
# For license information, please see license.txt
|
||||
|
||||
from __future__ import unicode_literals
|
||||
from frappe.model.document import Document
|
||||
|
||||
class SetupProgressAction(Document):
|
||||
pass
|
||||
@@ -20,6 +20,28 @@ def install(country=None):
|
||||
{ 'doctype': 'Domain', 'domain': _('Services')},
|
||||
{ 'doctype': 'Domain', 'domain': _('Education')},
|
||||
|
||||
# Setup Progress
|
||||
{'doctype': "Setup Progress", "actions": [
|
||||
{"action_name": _("Add Company"), "action_doctype": "Company", "min_doc_count": 1, "is_completed": 1,
|
||||
"domains": '[]' },
|
||||
{"action_name": _("Add Customers"), "action_doctype": "Customer", "min_doc_count": 1, "is_completed": 0,
|
||||
"domains": '["Manufacturing", "Services", "Retail", "Distribution"]' },
|
||||
{"action_name": _("Add Suppliers"), "action_doctype": "Supplier", "min_doc_count": 1, "is_completed": 0,
|
||||
"domains": '["Manufacturing", "Services", "Retail", "Distribution"]' },
|
||||
{"action_name": _("Add Products"), "action_doctype": "Item", "min_doc_count": 1, "is_completed": 0,
|
||||
"domains": '["Manufacturing", "Services", "Retail", "Distribution"]' },
|
||||
{"action_name": _("Add Programs"), "action_doctype": "Program", "min_doc_count": 1, "is_completed": 0,
|
||||
"domains": '["Education"]' },
|
||||
{"action_name": _("Add Instructors"), "action_doctype": "Instructor", "min_doc_count": 1, "is_completed": 0,
|
||||
"domains": '["Education"]' },
|
||||
{"action_name": _("Add Courses"), "action_doctype": "Course", "min_doc_count": 1, "is_completed": 0,
|
||||
"domains": '["Education"]' },
|
||||
{"action_name": _("Add Rooms"), "action_doctype": "Room", "min_doc_count": 1, "is_completed": 0,
|
||||
"domains": '["Education"]' },
|
||||
{"action_name": _("Add Users"), "action_doctype": "User", "min_doc_count": 4, "is_completed": 0,
|
||||
"domains": '[]' }
|
||||
]},
|
||||
|
||||
# address template
|
||||
{'doctype':"Address Template", "country": country},
|
||||
|
||||
|
||||
@@ -10,26 +10,27 @@ import random, os, json
|
||||
from frappe import _
|
||||
from markdown2 import markdown
|
||||
|
||||
def make_sample_data(args):
|
||||
def make_sample_data(domain, make_dependent = False):
|
||||
"""Create a few opportunities, quotes, material requests, issues, todos, projects
|
||||
to help the user get started"""
|
||||
items = frappe.get_all("Item", {'is_sales_item': 1})
|
||||
|
||||
customers = frappe.get_all("Customer")
|
||||
warehouses = frappe.get_all("Warehouse")
|
||||
if make_dependent:
|
||||
items = frappe.get_all("Item", {'is_sales_item': 1})
|
||||
customers = frappe.get_all("Customer")
|
||||
warehouses = frappe.get_all("Warehouse")
|
||||
|
||||
if items and customers:
|
||||
for i in range(3):
|
||||
customer = random.choice(customers).name
|
||||
make_opportunity(items, customer)
|
||||
make_quote(items, customer)
|
||||
if items and customers:
|
||||
for i in range(3):
|
||||
customer = random.choice(customers).name
|
||||
make_opportunity(items, customer)
|
||||
make_quote(items, customer)
|
||||
|
||||
make_projects(args.get('domain'))
|
||||
if items and warehouses:
|
||||
make_material_request(frappe.get_all("Item"))
|
||||
|
||||
make_projects(domain)
|
||||
import_email_alert()
|
||||
|
||||
if items and warehouses:
|
||||
make_material_request(frappe.get_all("Item"))
|
||||
|
||||
frappe.db.commit()
|
||||
|
||||
def make_opportunity(items, customer):
|
||||
|
||||
@@ -15,6 +15,7 @@ from .sample_data import make_sample_data
|
||||
from erpnext.accounts.doctype.account.account import RootNotEditable
|
||||
from frappe.core.doctype.communication.comment import add_info_comment
|
||||
from erpnext.setup.setup_wizard.domainify import setup_domain
|
||||
from erpnext.setup.doctype.company.company import install_country_fixtures
|
||||
|
||||
def setup_complete(args=None):
|
||||
if frappe.db.sql("select name from tabCompany"):
|
||||
@@ -25,24 +26,16 @@ def setup_complete(args=None):
|
||||
create_price_lists(args)
|
||||
create_fiscal_year_and_company(args)
|
||||
create_sales_tax(args)
|
||||
create_users(args)
|
||||
create_employee_for_self(args)
|
||||
set_defaults(args)
|
||||
create_territories()
|
||||
create_feed_and_todo()
|
||||
create_email_digest()
|
||||
create_letter_head(args)
|
||||
create_taxes(args)
|
||||
create_items(args)
|
||||
create_customers(args)
|
||||
create_suppliers(args)
|
||||
|
||||
if args.get('domain').lower() == 'education':
|
||||
create_academic_year()
|
||||
create_academic_term()
|
||||
create_program(args)
|
||||
create_course(args)
|
||||
create_instructor(args)
|
||||
create_room(args)
|
||||
|
||||
if args.get('setup_website'):
|
||||
website_maker(args)
|
||||
@@ -58,16 +51,19 @@ def setup_complete(args=None):
|
||||
frappe.db.commit()
|
||||
frappe.clear_cache()
|
||||
|
||||
if args.get("add_sample_data"):
|
||||
try:
|
||||
make_sample_data(args)
|
||||
frappe.clear_cache()
|
||||
except:
|
||||
# clear message
|
||||
if frappe.message_log:
|
||||
frappe.message_log.pop()
|
||||
try:
|
||||
make_sample_data(args.get('domain'))
|
||||
frappe.clear_cache()
|
||||
except:
|
||||
# clear message
|
||||
if frappe.message_log:
|
||||
frappe.message_log.pop()
|
||||
|
||||
pass
|
||||
pass
|
||||
|
||||
def setup_success(args=None):
|
||||
company = frappe.db.sql("select name from tabCompany", as_dict=True)[0]["name"]
|
||||
install_country_fixtures(company)
|
||||
|
||||
def create_fiscal_year_and_company(args):
|
||||
if (args.get('fy_start_date')):
|
||||
@@ -91,8 +87,7 @@ def create_fiscal_year_and_company(args):
|
||||
'country': args.get('country'),
|
||||
'create_chart_of_accounts_based_on': 'Standard Template',
|
||||
'chart_of_accounts': args.get('chart_of_accounts'),
|
||||
'domain': args.get('domain'),
|
||||
'sales_target': args.get('sales_target')
|
||||
'domain': args.get('domain')
|
||||
}).insert()
|
||||
|
||||
#Enable shopping cart
|
||||
@@ -259,22 +254,7 @@ def create_sales_tax(args):
|
||||
tax_data.get('account_name'),
|
||||
tax_data.get('tax_rate'), sales_tax)
|
||||
|
||||
def get_country_wise_tax(country):
|
||||
data = {}
|
||||
with open (os.path.join(os.path.dirname(__file__), "data", "country_wise_tax.json")) as countrywise_tax:
|
||||
data = json.load(countrywise_tax).get(country)
|
||||
|
||||
return data
|
||||
|
||||
def create_taxes(args):
|
||||
for i in xrange(1,6):
|
||||
if args.get("tax_" + str(i)):
|
||||
# replace % in case someone also enters the % symbol
|
||||
tax_rate = cstr(args.get("tax_rate_" + str(i)) or "").replace("%", "")
|
||||
account_name = args.get("tax_" + str(i))
|
||||
|
||||
make_tax_account_and_template(args.get("company_name") , account_name, tax_rate)
|
||||
|
||||
# Tax utils start
|
||||
def make_tax_account_and_template(company, account_name, tax_rate, template_name=None):
|
||||
try:
|
||||
if not isinstance(account_name, (list, tuple)):
|
||||
@@ -292,15 +272,6 @@ def make_tax_account_and_template(company, account_name, tax_rate, template_name
|
||||
except RootNotEditable:
|
||||
pass
|
||||
|
||||
def get_tax_account_group(company):
|
||||
tax_group = frappe.db.get_value("Account",
|
||||
{"account_name": "Duties and Taxes", "is_group": 1, "company": company})
|
||||
if not tax_group:
|
||||
tax_group = frappe.db.get_value("Account", {"is_group": 1, "root_type": "Liability",
|
||||
"account_type": "Tax", "company": company})
|
||||
|
||||
return tax_group
|
||||
|
||||
def make_tax_account(company, account_name, tax_rate):
|
||||
tax_group = get_tax_account_group(company)
|
||||
if tax_group:
|
||||
@@ -345,115 +316,23 @@ def make_sales_and_purchase_tax_templates(accounts, template_name=None):
|
||||
doc = frappe.get_doc(purchase_tax_template)
|
||||
doc.insert(ignore_permissions=True)
|
||||
|
||||
def create_items(args):
|
||||
for i in xrange(1,6):
|
||||
item = args.get("item_" + str(i))
|
||||
if item:
|
||||
item_group = _(args.get("item_group_" + str(i)))
|
||||
is_sales_item = args.get("is_sales_item_" + str(i))
|
||||
is_purchase_item = args.get("is_purchase_item_" + str(i))
|
||||
is_stock_item = item_group!=_("Services")
|
||||
default_warehouse = ""
|
||||
if is_stock_item:
|
||||
default_warehouse = frappe.db.get_value("Warehouse", filters={
|
||||
"warehouse_name": _("Finished Goods") if is_sales_item else _("Stores"),
|
||||
"company": args.get("company_name")
|
||||
})
|
||||
def get_tax_account_group(company):
|
||||
tax_group = frappe.db.get_value("Account",
|
||||
{"account_name": "Duties and Taxes", "is_group": 1, "company": company})
|
||||
if not tax_group:
|
||||
tax_group = frappe.db.get_value("Account", {"is_group": 1, "root_type": "Liability",
|
||||
"account_type": "Tax", "company": company})
|
||||
|
||||
try:
|
||||
frappe.get_doc({
|
||||
"doctype":"Item",
|
||||
"item_code": item,
|
||||
"item_name": item,
|
||||
"description": item,
|
||||
"show_in_website": 1,
|
||||
"is_sales_item": is_sales_item,
|
||||
"is_purchase_item": is_purchase_item,
|
||||
"is_stock_item": is_stock_item and 1 or 0,
|
||||
"item_group": item_group,
|
||||
"stock_uom": _(args.get("item_uom_" + str(i))),
|
||||
"default_warehouse": default_warehouse
|
||||
}).insert()
|
||||
return tax_group
|
||||
|
||||
if args.get("item_img_" + str(i)):
|
||||
item_image = args.get("item_img_" + str(i)).split(",")
|
||||
if len(item_image)==3:
|
||||
filename, filetype, content = item_image
|
||||
fileurl = save_file(filename, content, "Item", item, decode=True).file_url
|
||||
frappe.db.set_value("Item", item, "image", fileurl)
|
||||
# Tax utils end
|
||||
|
||||
if args.get("item_price_" + str(i)):
|
||||
item_price = flt(args.get("item_price_" + str(i)))
|
||||
def get_country_wise_tax(country):
|
||||
data = {}
|
||||
with open (os.path.join(os.path.dirname(__file__), "data", "country_wise_tax.json")) as countrywise_tax:
|
||||
data = json.load(countrywise_tax).get(country)
|
||||
|
||||
if is_sales_item:
|
||||
price_list_name = frappe.db.get_value("Price List", {"selling": 1})
|
||||
make_item_price(item, price_list_name, item_price)
|
||||
|
||||
if is_purchase_item:
|
||||
price_list_name = frappe.db.get_value("Price List", {"buying": 1})
|
||||
make_item_price(item, price_list_name, item_price)
|
||||
|
||||
except frappe.NameError:
|
||||
pass
|
||||
|
||||
def make_item_price(item, price_list_name, item_price):
|
||||
frappe.get_doc({
|
||||
"doctype": "Item Price",
|
||||
"price_list": price_list_name,
|
||||
"item_code": item,
|
||||
"price_list_rate": item_price
|
||||
}).insert()
|
||||
|
||||
|
||||
def create_customers(args):
|
||||
for i in xrange(1,6):
|
||||
customer = args.get("customer_" + str(i))
|
||||
if customer:
|
||||
try:
|
||||
doc = frappe.get_doc({
|
||||
"doctype":"Customer",
|
||||
"customer_name": customer,
|
||||
"customer_type": "Company",
|
||||
"customer_group": _("Commercial"),
|
||||
"territory": args.get("country"),
|
||||
"company": args.get("company_name")
|
||||
}).insert()
|
||||
|
||||
if args.get("customer_contact_" + str(i)):
|
||||
create_contact(args.get("customer_contact_" + str(i)),
|
||||
"Customer", doc.name)
|
||||
except frappe.NameError:
|
||||
pass
|
||||
|
||||
def create_suppliers(args):
|
||||
for i in xrange(1,6):
|
||||
supplier = args.get("supplier_" + str(i))
|
||||
if supplier:
|
||||
try:
|
||||
doc = frappe.get_doc({
|
||||
"doctype":"Supplier",
|
||||
"supplier_name": supplier,
|
||||
"supplier_type": _("Local"),
|
||||
"company": args.get("company_name")
|
||||
}).insert()
|
||||
|
||||
if args.get("supplier_contact_" + str(i)):
|
||||
create_contact(args.get("supplier_contact_" + str(i)),
|
||||
"Supplier", doc.name)
|
||||
except frappe.NameError:
|
||||
pass
|
||||
|
||||
def create_contact(contact, party_type, party):
|
||||
"""Create contact based on given contact name"""
|
||||
contact = contact .split(" ")
|
||||
|
||||
contact = frappe.get_doc({
|
||||
"doctype":"Contact",
|
||||
"first_name":contact[0],
|
||||
"last_name": len(contact) > 1 and contact[1] or ""
|
||||
})
|
||||
contact.append('links', dict(link_doctype=party_type, link_name=party))
|
||||
contact.insert()
|
||||
return data
|
||||
|
||||
def create_letter_head(args):
|
||||
if args.get("attach_letterhead"):
|
||||
@@ -497,7 +376,7 @@ def login_as_first_user(args):
|
||||
if args.get("email") and hasattr(frappe.local, "login_manager"):
|
||||
frappe.local.login_manager.login_as(args.get("email"))
|
||||
|
||||
def create_users(args):
|
||||
def create_employee_for_self(args):
|
||||
if frappe.session.user == 'Administrator':
|
||||
return
|
||||
|
||||
@@ -512,50 +391,7 @@ def create_users(args):
|
||||
emp.flags.ignore_mandatory = True
|
||||
emp.insert(ignore_permissions = True)
|
||||
|
||||
for i in xrange(1,5):
|
||||
email = args.get("user_email_" + str(i))
|
||||
fullname = args.get("user_fullname_" + str(i))
|
||||
if email:
|
||||
if not fullname:
|
||||
fullname = email.split("@")[0]
|
||||
|
||||
parts = fullname.split(" ", 1)
|
||||
|
||||
user = frappe.get_doc({
|
||||
"doctype": "User",
|
||||
"email": email,
|
||||
"first_name": parts[0],
|
||||
"last_name": parts[1] if len(parts) > 1 else "",
|
||||
"enabled": 1,
|
||||
"user_type": "System User"
|
||||
})
|
||||
|
||||
# default roles
|
||||
user.append_roles("Projects User", "Stock User", "Support Team")
|
||||
|
||||
if args.get("user_sales_" + str(i)):
|
||||
user.append_roles("Sales User", "Sales Manager", "Accounts User")
|
||||
if args.get("user_purchaser_" + str(i)):
|
||||
user.append_roles("Purchase User", "Purchase Manager", "Accounts User")
|
||||
if args.get("user_accountant_" + str(i)):
|
||||
user.append_roles("Accounts Manager", "Accounts User")
|
||||
|
||||
user.flags.delay_emails = True
|
||||
|
||||
if not frappe.db.get_value("User", email):
|
||||
user.insert(ignore_permissions=True)
|
||||
|
||||
# create employee
|
||||
emp = frappe.get_doc({
|
||||
"doctype": "Employee",
|
||||
"employee_name": fullname,
|
||||
"user_id": email,
|
||||
"status": "Active",
|
||||
"company": args.get("company_name")
|
||||
})
|
||||
emp.flags.ignore_mandatory = True
|
||||
emp.insert(ignore_permissions = True)
|
||||
|
||||
# Schools
|
||||
def create_academic_term():
|
||||
at = ["Semester 1", "Semester 2", "Semester 3"]
|
||||
ay = ["2013-14", "2014-15", "2015-16", "2016-17", "2017-18"]
|
||||
@@ -578,46 +414,3 @@ def create_academic_year():
|
||||
academic_year.save()
|
||||
except frappe.DuplicateEntryError:
|
||||
pass
|
||||
|
||||
def create_program(args):
|
||||
for i in xrange(1,6):
|
||||
if args.get("program_" + str(i)):
|
||||
program = frappe.new_doc("Program")
|
||||
program.program_code = args.get("program_" + str(i))
|
||||
program.program_name = args.get("program_" + str(i))
|
||||
try:
|
||||
program.save()
|
||||
except frappe.DuplicateEntryError:
|
||||
pass
|
||||
|
||||
def create_course(args):
|
||||
for i in xrange(1,6):
|
||||
if args.get("course_" + str(i)):
|
||||
course = frappe.new_doc("Course")
|
||||
course.course_code = args.get("course_" + str(i))
|
||||
course.course_name = args.get("course_" + str(i))
|
||||
try:
|
||||
course.save()
|
||||
except frappe.DuplicateEntryError:
|
||||
pass
|
||||
|
||||
def create_instructor(args):
|
||||
for i in xrange(1,6):
|
||||
if args.get("instructor_" + str(i)):
|
||||
instructor = frappe.new_doc("Instructor")
|
||||
instructor.instructor_name = args.get("instructor_" + str(i))
|
||||
try:
|
||||
instructor.save()
|
||||
except frappe.DuplicateEntryError:
|
||||
pass
|
||||
|
||||
def create_room(args):
|
||||
for i in xrange(1,6):
|
||||
if args.get("room_" + str(i)):
|
||||
room = frappe.new_doc("Room")
|
||||
room.room_name = args.get("room_" + str(i))
|
||||
room.seating_capacity = args.get("room_capacity_" + str(i))
|
||||
try:
|
||||
room.save()
|
||||
except frappe.DuplicateEntryError:
|
||||
pass
|
||||
|
||||
57
erpnext/setup/setup_wizard/test_setup_wizard.py
Normal file
57
erpnext/setup/setup_wizard/test_setup_wizard.py
Normal file
@@ -0,0 +1,57 @@
|
||||
# Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors
|
||||
# License: GNU General Public License v3. See license.txt
|
||||
|
||||
from __future__ import unicode_literals
|
||||
|
||||
import frappe, time
|
||||
from frappe.utils.selenium_testdriver import TestDriver
|
||||
|
||||
def run_setup_wizard_test():
|
||||
driver = TestDriver()
|
||||
frappe.db.set_default('in_selenium', '1')
|
||||
|
||||
driver.login('#page-setup-wizard')
|
||||
print('Running Setup Wizard Test...')
|
||||
|
||||
# Language slide
|
||||
driver.set_select("language", "English (United Kingdom)")
|
||||
driver.wait_for_ajax(True)
|
||||
driver.wait_till_clickable(".next-btn").click()
|
||||
|
||||
# Region slide
|
||||
driver.wait_for_ajax(True)
|
||||
driver.set_select("country", "India")
|
||||
driver.wait_for_ajax(True)
|
||||
driver.wait_till_clickable(".next-btn").click()
|
||||
|
||||
# Profile slide
|
||||
driver.set_field("full_name", "Joe Davis")
|
||||
driver.set_field("email", "joe@example.com")
|
||||
driver.set_field("password", "somethingrandom")
|
||||
driver.wait_till_clickable(".next-btn").click()
|
||||
|
||||
# Brand slide
|
||||
driver.set_select("domain", "Manufacturing")
|
||||
driver.wait_till_clickable(".next-btn").click()
|
||||
|
||||
# Org slide
|
||||
driver.set_field("company_name", "Acme Corp")
|
||||
driver.wait_till_clickable(".next-btn").click()
|
||||
driver.set_field("company_tagline", "Build Tools for Builders")
|
||||
driver.set_field("bank_account", "BNL")
|
||||
driver.wait_till_clickable(".complete-btn").click()
|
||||
|
||||
# Wait for desk (Lock wait timeout error)
|
||||
# driver.wait_for('#page-desktop', timeout=200)
|
||||
|
||||
console = driver.get_console()
|
||||
if frappe.flags.tests_verbose:
|
||||
for line in console:
|
||||
print(line)
|
||||
print('-' * 40)
|
||||
time.sleep(1)
|
||||
|
||||
frappe.db.set_default('in_selenium', None)
|
||||
driver.close()
|
||||
|
||||
return True
|
||||
Reference in New Issue
Block a user