fix: installed application patch

This commit is contained in:
Rohit Waghchaure 2025-06-25 18:05:03 +05:30
parent da0becc6cf
commit 0af31ed7ed
2 changed files with 30 additions and 13 deletions

View file

@ -1,5 +1,5 @@
[pre_model_sync]
frappe.patches.v16_0.enable_setup_complete #25-06-2025
frappe.patches.v16_0.enable_setup_complete #25-06-2025 re-run-patch
frappe.patches.v15_0.remove_implicit_primary_key
frappe.patches.v12_0.remove_deprecated_fields_from_doctype #3
execute:frappe.utils.global_search.setup_global_search_table()

View file

@ -11,11 +11,12 @@ def execute():
):
is_setup_complete = 1
installed_apps = frappe.get_installed_apps(_ensure_on_bench=True)
for app_name in frappe.get_all("Installed Application", pluck="app_name"):
if app_name not in installed_apps:
continue
apps_details = frappe._dict({})
for details in frappe.utils.get_installed_apps_info():
apps_details[details.get("app_name")] = details
installed_apps = frappe.get_installed_apps(_ensure_on_bench=True)
for app_name in installed_apps:
has_setup_wizard = 0
if app_name == "frappe":
has_setup_wizard = 1
@ -23,11 +24,27 @@ def execute():
has_setup_wizard = 1
if has_setup_wizard:
frappe.db.set_value(
"Installed Application",
{"app_name": app_name},
{
"has_setup_wizard": 1,
"is_setup_complete": is_setup_complete,
},
)
if not frappe.db.exists("Installed Application", {"app_name": app_name}):
apps_detail = apps_details.get(app_name, {})
frappe.get_doc(
{
"doctype": "Installed Application",
"app_name": app_name,
"has_setup_wizard": 1,
"is_setup_complete": 1,
"app_version": apps_detail.get("version", ""),
"git_branch": apps_detail.get("branch", ""),
"parent": "Installed Applications",
"parenttype": "installed_applications",
}
).insert(ignore_permissions=True)
else:
frappe.db.set_value(
"Installed Application",
{"app_name": app_name},
{
"has_setup_wizard": 1,
"is_setup_complete": is_setup_complete,
},
)