diff --git a/frappe/patches.txt b/frappe/patches.txt index e01ee4b54b..3a20616fb0 100644 --- a/frappe/patches.txt +++ b/frappe/patches.txt @@ -248,4 +248,5 @@ frappe.patches.v14_0.fix_user_settings_collation execute:frappe.call("frappe.core.doctype.system_settings.system_settings.sync_system_settings") frappe.patches.v15_0.migrate_to_utm frappe.patches.v16_0.add_module_deprecation_warning -frappe.patches.v16_0.auto_generate_desktop_icon_and_sidebar \ No newline at end of file +frappe.patches.v16_0.auto_generate_desktop_icon_and_sidebar +frappe.patches.v16_0.add_private_workspaces_to_sidebar \ No newline at end of file diff --git a/frappe/patches/v16_0/add_private_workspaces_to_sidebar.py b/frappe/patches/v16_0/add_private_workspaces_to_sidebar.py new file mode 100644 index 0000000000..1f10e42af7 --- /dev/null +++ b/frappe/patches/v16_0/add_private_workspaces_to_sidebar.py @@ -0,0 +1,19 @@ +import click + +import frappe + + +def execute(): + from frappe.query_builder import DocType + + workspace = DocType("Workspace") + all_workspaces = (frappe.qb.from_(workspace).select(workspace.name).where(workspace.public == 0)).run( + pluck=True + ) + from frappe.desk.doctype.workspace_sidebar.workspace_sidebar import add_to_my_workspace + + for space in all_workspaces: + workspace_doc = frappe.get_doc("Workspace", space) + add_to_my_workspace(workspace_doc) + # save the sidebar items + frappe.db.commit() # nosemgrep