From 2e0db2d69e2cde6b428c7a7cfb62c23e7780598d Mon Sep 17 00:00:00 2001 From: Ejaaz Khan Date: Fri, 25 Apr 2025 14:51:16 +0530 Subject: [PATCH] fix: Module not found error for custom doctypes --- frappe/desk/form/linked_with.py | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/frappe/desk/form/linked_with.py b/frappe/desk/form/linked_with.py index cb1169276f..0c58b325a2 100644 --- a/frappe/desk/form/linked_with.py +++ b/frappe/desk/form/linked_with.py @@ -564,7 +564,16 @@ def _get_linked_doctypes(doctype, without_ignore_user_permissions_enabled=False) continue ret[dt] = {"get_parent": True} + custom_doctypes = frappe.get_all( + doctype="DocType", filters=[["custom", "=", 1], ["name", "in", list(ret.keys())]], as_list=True + ) + + custom_doctypes = [item[0] for item in custom_doctypes] + for dt in list(ret): + # if the custom checkbox is checked, then don't load the module of the DocType because it doesn't belong to any app. + if dt in custom_doctypes: + continue try: doctype_module = load_doctype_module(dt) except (ImportError, KeyError):