fix(delete_doc): Check ignore_links_on_delete with parent doctype (#20898)

This commit is contained in:
Saif Ur Rehman 2023-05-16 08:34:00 +05:00 committed by GitHub
parent 440cde45f7
commit 0b92078c60
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -328,6 +328,13 @@ def check_if_doc_is_dynamically_linked(doc, method="Delete"):
):
reference_doctype = refdoc.parenttype if meta.istable else df.parent
reference_docname = refdoc.parent if meta.istable else refdoc.name
if reference_doctype in frappe.get_hooks("ignore_links_on_delete") or (
reference_doctype in ignore_linked_doctypes and method == "Cancel"
):
# don't check for communication and todo!
continue
at_position = f"at Row: {refdoc.idx}" if meta.istable else ""
raise_link_exists_exception(doc, reference_doctype, reference_docname, at_position)