fix: Skip virtual doctypes in link field checks (#24759)

This commit is contained in:
Ankush Menat 2024-02-05 18:04:31 +05:30 committed by GitHub
parent 455c68ac55
commit b6eef6ebc2
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -614,6 +614,10 @@ def get_linked_fields(doctype, without_ignore_user_permissions_enabled=False):
if options in ret:
del ret[options]
virtual_doctypes = frappe.get_all("DocType", {"is_virtual": 1}, pluck="name")
for dt in virtual_doctypes:
ret.pop(dt, None)
return ret
@ -640,7 +644,11 @@ def get_dynamic_linked_fields(doctype, without_ignore_user_permissions_enabled=F
if is_single(df.doctype):
continue
is_child = frappe.get_meta(df.doctype).istable
meta = frappe.get_meta(df.doctype)
if meta.is_virtual:
continue
is_child = meta.istable
possible_link = frappe.get_all(
df.doctype,
filters={df.doctype_fieldname: doctype},