fix: cleanup desktop_icon

This commit is contained in:
sokumon 2025-10-31 00:16:16 +05:30
parent bf0dd1bf24
commit bfea06a108

View file

@ -627,13 +627,10 @@ def create_desktop_icons_from_workspace():
icon.standard = 1
icon.link_to = w.name
icon.icon = w.icon
icon.app = w.app
if w.module:
app_name = frappe.db.get_value("Module Def", w.module, "app_name")
app_title = frappe.get_hooks("app_title", app_name=app_name)[0]
print(app_title)
app_icon = frappe.db.exists("Desktop Icon", {"label": app_title, "icon_type": "App"})
if app_icon:
icon.parent_icon = app_icon
@ -646,7 +643,8 @@ def create_desktop_icons_from_workspace():
if icon.label == app_title and frappe.db.get_value("Desktop Icon", app_icon, "link").startswith(
"/app"
):
frappe.db.set_value("Desktop Icon", app_icon, "icon", icon.icon)
icon.hidden = 1
icon.parent_icon = None
if not frappe.db.exists("Desktop Icon", [{"label": icon.label, "link_type": icon.link_type}]):
icon.insert(ignore_if_duplicate=True)
frappe.db.commit()
@ -672,6 +670,8 @@ def create_desktop_icons_from_installed_apps():
icon.icon_type = "App"
icon.link = app_details[0]["route"]
icon.logo_url = app_details[0]["logo"]
print(icon.label)
print(icon.icon_type)
if not frappe.db.exists("Desktop Icon", [{"label": icon.label, "icon_type": icon.icon_type}]):
icon.save()
index += 1