fix: add a patch to mark auto generated desktop icons as non standard
This commit is contained in:
parent
ec73e3a70c
commit
0b20e81824
3 changed files with 23 additions and 2 deletions
|
|
@ -221,7 +221,6 @@ def create_desktop_icons_from_workspace():
|
||||||
icon.link_type = "Workspace Sidebar"
|
icon.link_type = "Workspace Sidebar"
|
||||||
icon.label = w.name
|
icon.label = w.name
|
||||||
icon.icon_type = "Link"
|
icon.icon_type = "Link"
|
||||||
icon.standard = 1
|
|
||||||
icon.link_to = w.name
|
icon.link_to = w.name
|
||||||
icon.icon = w.icon
|
icon.icon = w.icon
|
||||||
if w.module:
|
if w.module:
|
||||||
|
|
@ -267,7 +266,6 @@ def create_desktop_icons_from_installed_apps():
|
||||||
icon = frappe.new_doc("Desktop Icon")
|
icon = frappe.new_doc("Desktop Icon")
|
||||||
icon.label = app_title
|
icon.label = app_title
|
||||||
icon.link_type = "External"
|
icon.link_type = "External"
|
||||||
icon.standard = 1
|
|
||||||
icon.idx = index
|
icon.idx = index
|
||||||
icon.icon_type = "App"
|
icon.icon_type = "App"
|
||||||
icon.app = a
|
icon.app = a
|
||||||
|
|
@ -281,3 +279,7 @@ def create_desktop_icons_from_installed_apps():
|
||||||
def create_desktop_icons():
|
def create_desktop_icons():
|
||||||
create_desktop_icons_from_installed_apps()
|
create_desktop_icons_from_installed_apps()
|
||||||
create_desktop_icons_from_workspace()
|
create_desktop_icons_from_workspace()
|
||||||
|
|
||||||
|
|
||||||
|
def create_user_icons(user, data):
|
||||||
|
print("Hello")
|
||||||
|
|
|
||||||
|
|
@ -256,3 +256,4 @@ frappe.patches.v16_0.change_link_type_to_workspace_sidebar
|
||||||
frappe.patches.v16_0.add_standard_field_in_workspace_sidebar
|
frappe.patches.v16_0.add_standard_field_in_workspace_sidebar
|
||||||
execute:frappe.db.set_single_value("Desktop Settings", "icon_style", "Solid")
|
execute:frappe.db.set_single_value("Desktop Settings", "icon_style", "Solid")
|
||||||
execute:frappe.delete_doc_if_exists("Workspace Sidebar", "Productivity")
|
execute:frappe.delete_doc_if_exists("Workspace Sidebar", "Productivity")
|
||||||
|
frappe.patches.v16_0.unset_standard_field_for_auto_generated_icons
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,18 @@
|
||||||
|
import frappe
|
||||||
|
from frappe.model.sync import check_if_record_exists
|
||||||
|
|
||||||
|
|
||||||
|
def execute():
|
||||||
|
for icon in frappe.get_all("Desktop Icon"):
|
||||||
|
icon_doc = frappe.get_doc("Desktop Icon", icon.name)
|
||||||
|
if (icon_doc.standard and icon_doc.app) and not check_if_record_exists(
|
||||||
|
"app",
|
||||||
|
frappe.get_app_path(icon_doc.app),
|
||||||
|
"Desktop Icon",
|
||||||
|
icon_doc.name,
|
||||||
|
):
|
||||||
|
try:
|
||||||
|
icon_doc.standard = 0
|
||||||
|
icon_doc.save()
|
||||||
|
except Exception as e:
|
||||||
|
print("Error in unsetting standard field", e)
|
||||||
Loading…
Add table
Reference in a new issue