fix: Delete Auto Email Reports (#22009)

diff --git a/erpnext/patches/v13_0/delete_old_purchase_reports.py b/erpnext/patches/v13_0/delete_old_purchase_reports.py
index 8271d2e..8bdc07e 100644
--- a/erpnext/patches/v13_0/delete_old_purchase_reports.py
+++ b/erpnext/patches/v13_0/delete_old_purchase_reports.py
@@ -12,4 +12,12 @@
 
 	for report in reports_to_delete:
 		if frappe.db.exists("Report", report):
-			frappe.delete_doc("Report", report)
\ No newline at end of file
+			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])
\ No newline at end of file