feat: ignore permission when deleting linked emails (#20751)
* feat: ignore permission when deleting linked emails
* fix: uncommented important snippet
diff --git a/erpnext/setup/doctype/company/delete_company_transactions.py b/erpnext/setup/doctype/company/delete_company_transactions.py
index 1503adb..8ecc13b 100644
--- a/erpnext/setup/doctype/company/delete_company_transactions.py
+++ b/erpnext/setup/doctype/company/delete_company_transactions.py
@@ -108,8 +108,8 @@
def delete_communications(doctype, company_name, company_fieldname):
reference_docs = frappe.get_all(doctype, filters={company_fieldname:company_name})
reference_doc_names = [r.name for r in reference_docs]
-
+
communications = frappe.get_all("Communication", filters={"reference_doctype":doctype,"reference_name":["in", reference_doc_names]})
communication_names = [c.name for c in communications]
- frappe.delete_doc("Communication", communication_names)
+ frappe.delete_doc("Communication", communication_names, ignore_permissions=True)