mirror of
https://github.com/frappe/erpnext.git
synced 2026-05-23 23:19:20 +00:00
refactor: track completed app setup wizards and re-run the setup wizard upon new app installation. (backport #47691) (#48223)
* refactor: track completed app setup wizards and re-run the setup wizard upon new app installation. (#47691)
(cherry picked from commit 75b5ba6e67)
# Conflicts:
# erpnext/hooks.py
# erpnext/setup/install.py
* chore: fix conflicts
* chore: fix conflicts
* chore: fix conflicts
* fix: permission issue
* fix: space
---------
Co-authored-by: rohitwaghchaure <rohitw1991@gmail.com>
This commit is contained in:
@@ -57,7 +57,6 @@ setup_wizard_complete = "erpnext.setup.setup_wizard.setup_wizard.setup_demo"
|
|||||||
setup_wizard_test = "erpnext.setup.setup_wizard.test_setup_wizard.run_setup_wizard_test"
|
setup_wizard_test = "erpnext.setup.setup_wizard.test_setup_wizard.run_setup_wizard_test"
|
||||||
|
|
||||||
before_install = [
|
before_install = [
|
||||||
"erpnext.setup.install.check_setup_wizard_not_completed",
|
|
||||||
"erpnext.setup.install.check_frappe_version",
|
"erpnext.setup.install.check_frappe_version",
|
||||||
]
|
]
|
||||||
after_install = "erpnext.setup.install.after_install"
|
after_install = "erpnext.setup.install.after_install"
|
||||||
|
|||||||
@@ -8,6 +8,13 @@ frappe.pages["setup-wizard"].on_page_load = function (wrapper) {
|
|||||||
};
|
};
|
||||||
|
|
||||||
frappe.setup.on("before_load", function () {
|
frappe.setup.on("before_load", function () {
|
||||||
|
if (
|
||||||
|
frappe.boot.setup_wizard_completed_apps?.length &&
|
||||||
|
frappe.boot.setup_wizard_completed_apps.includes("erpnext")
|
||||||
|
) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
erpnext.setup.slides_settings.map(frappe.setup.add_slide);
|
erpnext.setup.slides_settings.map(frappe.setup.add_slide);
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -96,7 +103,7 @@ erpnext.setup.slides_settings = [
|
|||||||
},
|
},
|
||||||
|
|
||||||
set_fy_dates: function (slide) {
|
set_fy_dates: function (slide) {
|
||||||
var country = frappe.wizard.values.country;
|
var country = frappe.wizard.values.country || frappe.defaults.get_default("country");
|
||||||
|
|
||||||
if (country) {
|
if (country) {
|
||||||
let fy = erpnext.setup.fiscal_years[country];
|
let fy = erpnext.setup.fiscal_years[country];
|
||||||
@@ -118,7 +125,7 @@ erpnext.setup.slides_settings = [
|
|||||||
},
|
},
|
||||||
|
|
||||||
load_chart_of_accounts: function (slide) {
|
load_chart_of_accounts: function (slide) {
|
||||||
let country = frappe.wizard.values.country;
|
let country = frappe.wizard.values.country || frappe.defaults.get_default("country");
|
||||||
|
|
||||||
if (country) {
|
if (country) {
|
||||||
frappe.call({
|
frappe.call({
|
||||||
|
|||||||
@@ -39,13 +39,6 @@ def after_install():
|
|||||||
frappe.db.commit()
|
frappe.db.commit()
|
||||||
|
|
||||||
|
|
||||||
def check_setup_wizard_not_completed():
|
|
||||||
if cint(frappe.db.get_single_value("System Settings", "setup_complete") or 0):
|
|
||||||
message = """ERPNext can only be installed on a fresh site where the setup wizard is not completed.
|
|
||||||
You can reinstall this site (after saving your data) using: bench --site [sitename] reinstall"""
|
|
||||||
frappe.throw(message) # nosemgrep
|
|
||||||
|
|
||||||
|
|
||||||
def check_frappe_version():
|
def check_frappe_version():
|
||||||
def major_version(v: str) -> str:
|
def major_version(v: str) -> str:
|
||||||
return v.split(".")[0]
|
return v.split(".")[0]
|
||||||
|
|||||||
@@ -504,6 +504,7 @@ def update_stock_settings():
|
|||||||
stock_settings.auto_insert_price_list_rate_if_missing = 1
|
stock_settings.auto_insert_price_list_rate_if_missing = 1
|
||||||
stock_settings.update_price_list_based_on = "Rate"
|
stock_settings.update_price_list_based_on = "Rate"
|
||||||
stock_settings.set_qty_in_transactions_based_on_serial_no_input = 1
|
stock_settings.set_qty_in_transactions_based_on_serial_no_input = 1
|
||||||
|
stock_settings.flags.ignore_permissions = True
|
||||||
stock_settings.save()
|
stock_settings.save()
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -4,6 +4,7 @@
|
|||||||
|
|
||||||
import frappe
|
import frappe
|
||||||
from frappe import _
|
from frappe import _
|
||||||
|
from frappe.core.doctype.installed_applications.installed_applications import get_setup_wizard_completed_apps
|
||||||
|
|
||||||
import erpnext
|
import erpnext
|
||||||
|
|
||||||
@@ -45,7 +46,7 @@ def get_level():
|
|||||||
activation_level += 1
|
activation_level += 1
|
||||||
sales_data.append({doctype: count})
|
sales_data.append({doctype: count})
|
||||||
|
|
||||||
if frappe.db.get_single_value("System Settings", "setup_complete"):
|
if "erpnext" in get_setup_wizard_completed_apps():
|
||||||
activation_level += 1
|
activation_level += 1
|
||||||
|
|
||||||
communication_number = frappe.db.count("Communication", dict(communication_medium="Email"))
|
communication_number = frappe.db.count("Communication", dict(communication_medium="Email"))
|
||||||
|
|||||||
Reference in New Issue
Block a user