fix: Add demo setup check in setup wizard
This commit is contained in:
parent
d5bdd9387a
commit
bb5387fa5d
@ -20,6 +20,7 @@
|
||||
"public/js/queries.js",
|
||||
"public/js/sms_manager.js",
|
||||
"public/js/utils/party.js",
|
||||
"public/js/utils/demo.js",
|
||||
"public/js/controllers/stock_controller.js",
|
||||
"public/js/payment/payments.js",
|
||||
"public/js/controllers/taxes_and_totals.js",
|
||||
|
@ -38,6 +38,7 @@ erpnext.setup.slides_settings = [
|
||||
{ fieldname: 'fy_start_date', label: __('Financial Year Begins On'), fieldtype: 'Date', reqd: 1 },
|
||||
// end date should be hidden (auto calculated)
|
||||
{ fieldname: 'fy_end_date', label: __('End Date'), fieldtype: 'Date', reqd: 1, hidden: 1 },
|
||||
{ fieldname: 'setup_demo', label: __('Generate dummy data for demo'), fieldtype: 'Check'},
|
||||
],
|
||||
|
||||
onload: function (slide) {
|
||||
|
11
erpnext/public/js/utils/demo.js
Normal file
11
erpnext/public/js/utils/demo.js
Normal file
@ -0,0 +1,11 @@
|
||||
$(document).on("toolbar_setup", function() {
|
||||
if (erpnext.is_demo_company_setup) {
|
||||
console.log("setup");
|
||||
}
|
||||
});
|
||||
|
||||
erpnext.is_demo_company_setup = function() {
|
||||
frappe.db.get_value("Global Default", "Global Default", "demo_company", function(r) {
|
||||
console.log(r);
|
||||
});
|
||||
};
|
@ -28,7 +28,7 @@ def clear_demo_data():
|
||||
|
||||
|
||||
def create_demo_company():
|
||||
company = erpnext.get_default_company()
|
||||
company = frappe.db.get_all("Company")[0].name
|
||||
company_doc = frappe.get_doc("Company", company)
|
||||
|
||||
# Make a dummy company
|
||||
|
@ -5,6 +5,7 @@
|
||||
import frappe
|
||||
from frappe import _
|
||||
|
||||
from ..demo import setup_demo_data
|
||||
from .operations import install_fixtures as fixtures
|
||||
|
||||
|
||||
@ -36,6 +37,11 @@ def get_setup_stages(args=None):
|
||||
{"fn": setup_defaults, "args": args, "fail_msg": _("Failed to setup defaults")},
|
||||
],
|
||||
},
|
||||
{
|
||||
"status": _("Setting up demo data"),
|
||||
"fail_msg": _("Failed to setup demo data"),
|
||||
"tasks": [{"fn": setup_demo, "args": args, "fail_msg": _("Failed to login")}],
|
||||
},
|
||||
{
|
||||
"status": _("Wrapping up"),
|
||||
"fail_msg": _("Failed to login"),
|
||||
@ -63,6 +69,11 @@ def fin(args):
|
||||
login_as_first_user(args)
|
||||
|
||||
|
||||
def setup_demo(args):
|
||||
if args.get("setup_demo"):
|
||||
setup_demo_data()
|
||||
|
||||
|
||||
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"))
|
||||
|
Loading…
x
Reference in New Issue
Block a user