From 6b9acf4476c23673b840cc48ef338a7dd9123a8b Mon Sep 17 00:00:00 2001 From: Afshan Date: Wed, 22 Jul 2020 16:00:18 +0530 Subject: [PATCH] updated patch to delete auto email reports and moved patch to v13 from v12 --- erpnext/patches.txt | 2 +- .../v12_0/delete_report_requested_items_to_order.py | 7 ------- .../v13_0/delete_report_requested_items_to_order.py | 12 ++++++++++++ 3 files changed, 13 insertions(+), 8 deletions(-) delete mode 100644 erpnext/patches/v12_0/delete_report_requested_items_to_order.py create mode 100644 erpnext/patches/v13_0/delete_report_requested_items_to_order.py diff --git a/erpnext/patches.txt b/erpnext/patches.txt index 782234069a..da390f54fd 100644 --- a/erpnext/patches.txt +++ b/erpnext/patches.txt @@ -708,5 +708,5 @@ erpnext.patches.v13_0.move_doctype_reports_and_notification_from_hr_to_payroll # erpnext.patches.v13_0.move_payroll_setting_separately_from_hr_settings #22-06-2020 erpnext.patches.v13_0.check_is_income_tax_component #22-06-2020 erpnext.patches.v12_0.add_taxjar_integration_field -erpnext.patches.v12_0.delete_report_requested_items_to_order +erpnext.patches.v13_0.delete_report_requested_items_to_order erpnext.patches.v12_0.update_item_tax_template_company diff --git a/erpnext/patches/v12_0/delete_report_requested_items_to_order.py b/erpnext/patches/v12_0/delete_report_requested_items_to_order.py deleted file mode 100644 index 0296d47bde..0000000000 --- a/erpnext/patches/v12_0/delete_report_requested_items_to_order.py +++ /dev/null @@ -1,7 +0,0 @@ -import frappe - -def execute(): - frappe.db.sql(""" - DELETE FROM `tabReport` - WHERE name = 'Requested Items to Order' - """) \ No newline at end of file diff --git a/erpnext/patches/v13_0/delete_report_requested_items_to_order.py b/erpnext/patches/v13_0/delete_report_requested_items_to_order.py new file mode 100644 index 0000000000..94a9fa85a8 --- /dev/null +++ b/erpnext/patches/v13_0/delete_report_requested_items_to_order.py @@ -0,0 +1,12 @@ +import frappe + +def execute(): + """ Check for one or multiple Auto Email Reports and delete """ + auto_email_reports = frappe.db.get_values("Auto Email Report", {"report": "Requested Items to Order"}, ["name"]) + for auto_email_report in auto_email_reports: + frappe.delete_doc("Auto Email Report", auto_email_report[0]) + + frappe.db.sql(""" + DELETE FROM `tabReport` + WHERE name = 'Requested Items to Order' + """) \ No newline at end of file