feat(patch): add private workspaces to my workspaces

This commit is contained in:
sokumon 2025-11-14 11:58:05 +05:30
parent 0d18a4d00e
commit 4d281fa5cc
2 changed files with 21 additions and 1 deletions

View file

@ -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
frappe.patches.v16_0.auto_generate_desktop_icon_and_sidebar
frappe.patches.v16_0.add_private_workspaces_to_sidebar

View file

@ -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