From b969282e8ff24be37c8c742fb5b3c086520b15e2 Mon Sep 17 00:00:00 2001 From: KerollesFathy Date: Tue, 10 Mar 2026 15:52:15 +0000 Subject: [PATCH 1/2] fix: route conflict not detected when workspace matches existing DocType --- frappe/desk/utils.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/frappe/desk/utils.py b/frappe/desk/utils.py index 47aace7b4b..95995392aa 100644 --- a/frappe/desk/utils.py +++ b/frappe/desk/utils.py @@ -17,7 +17,11 @@ def validate_route_conflict(doctype, name): all_names = [] for _doctype in ["Page", "Workspace", "DocType"]: all_names.extend( - [slug(d) for d in frappe.get_all(_doctype, pluck="name") if (doctype != _doctype and d != name)] + [ + slug(d) + for d in frappe.get_all(_doctype, pluck="name") + if not (doctype == _doctype and d == name) + ] ) if slug(name) in all_names: From 929fb66ac67ae5f66596d4cd3e4c289c53677622 Mon Sep 17 00:00:00 2001 From: KerollesFathy Date: Wed, 11 Mar 2026 00:44:09 +0000 Subject: [PATCH 2/2] test: add test for workspace name conflict with existing DocType --- frappe/desk/doctype/workspace/test_workspace.py | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/frappe/desk/doctype/workspace/test_workspace.py b/frappe/desk/doctype/workspace/test_workspace.py index d27e321050..24338ba9d9 100644 --- a/frappe/desk/doctype/workspace/test_workspace.py +++ b/frappe/desk/doctype/workspace/test_workspace.py @@ -13,6 +13,15 @@ class TestWorkspace(IntegrationTestCase): frappe.db.delete("DocType", {"module": "Test Module"}) frappe.delete_doc("Module Def", "Test Module") + def test_workspace_conflicts_with_existing_doctype(self): + """Workspace name should not conflict with existing DocType names.""" + + create_doctype("Test", "Test Module") + workspace = create_workspace(name="Test", label="Test", public=1, title="Test") + + with self.assertRaises(frappe.NameError): + workspace.insert() + # TODO: FIX ME - flaky test!!! # def test_workspace_with_cards_specific_to_a_country(self): # workspace = create_workspace() @@ -65,6 +74,8 @@ def create_workspace(**args): workspace.category = args.category or "Modules" workspace.is_standard = args.is_standard or 1 workspace.module = "Test Module" + workspace.public = args.public or 0 + workspace.title = args.title or "Test Workspace" return workspace