diff --git a/frappe/model/delete_doc.py b/frappe/model/delete_doc.py index 131374a1d6..ab15dab74e 100644 --- a/frappe/model/delete_doc.py +++ b/frappe/model/delete_doc.py @@ -14,6 +14,8 @@ from frappe.model.naming import revert_series_if_last from frappe.utils.global_search import delete_for_document from six import string_types, integer_types +doctypes_to_skip = ("Communication", "ToDo", "DocShare", "Email Unsubscribe", "Activity Log", "File", "Version", "Document Follow", "Comment" , "View Log") + def delete_doc(doctype=None, name=None, force=0, ignore_doctypes=None, for_reload=False, ignore_permissions=False, flags=None, ignore_on_trash=False, ignore_missing=True): """ @@ -195,7 +197,7 @@ def check_if_doc_is_linked(doc, method="Delete"): for item in frappe.db.get_values(link_dt, {link_field:doc.name}, ["name", "parent", "parenttype", "docstatus"], as_dict=True): linked_doctype = item.parenttype if item.parent else link_dt - if linked_doctype in ("Communication", "ToDo", "DocShare", "Email Unsubscribe", 'File', 'Version', "Activity Log", "Document Follow"): + if linked_doctype in doctypes_to_skip: # don't check for communication and todo! continue @@ -220,7 +222,7 @@ def check_if_doc_is_linked(doc, method="Delete"): def check_if_doc_is_dynamically_linked(doc, method="Delete"): '''Raise `frappe.LinkExistsError` if the document is dynamically linked''' for df in get_dynamic_link_map().get(doc.doctype, []): - if df.parent in ("Communication", "ToDo", "DocShare", "Email Unsubscribe", "Activity Log", 'File', 'Version', 'View Log', "Document Follow"): + if df.parent in doctypes_to_skip: # don't check for communication and todo! continue