fix: Delete Auto Email Reports (#22010)

This commit is contained in:
Marica 2020-05-28 18:31:50 +05:30 committed by GitHub
parent fa0b73ce25
commit 354baf0c5e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -12,4 +12,12 @@ def execute():
for report in reports_to_delete:
if frappe.db.exists("Report", report):
frappe.delete_doc("Report", report)
delete_auto_email_reports(report)
frappe.delete_doc("Report", report)
def delete_auto_email_reports(report):
""" Check for one or multiple Auto Email Reports and delete """
auto_email_reports = frappe.db.get_values("Auto Email Report", {"report": report}, ["name"])
for auto_email_report in auto_email_reports:
frappe.delete_doc("Auto Email Report", auto_email_report[0])