diff --git a/erpnext/patches/v8_1/delete_deprecated_reports.py b/erpnext/patches/v8_1/delete_deprecated_reports.py index 2cb84a9a5fa..7e861319bf8 100644 --- a/erpnext/patches/v8_1/delete_deprecated_reports.py +++ b/erpnext/patches/v8_1/delete_deprecated_reports.py @@ -7,9 +7,25 @@ import frappe def execute(): """ delete deprecated reports """ - reports = ["Monthly Salary Register", "Customer Addresses And Contacts", - "Supplier Addresses And Contacts"] + reports = [ + "Monthly Salary Register", "Customer Addresses And Contacts", + "Supplier Addresses And Contacts" + ] for report in reports: if frappe.db.exists("Report", report): - frappe.delete_doc("Report", report, ignore_permissions=True) \ No newline at end of file + check_and_update_desktop_icon_for_report(report) + frappe.delete_doc("Report", report, ignore_permissions=True) + +def check_and_update_desktop_icon_for_report(report): + """ delete desktop icon for deprecated desktop icon and update the _report for Addresses And Contacts""" + + if report == "Monthly Salary Register": + frappe.delete_doc("Desktop Icon", report) + + elif report in ["Customer Addresses And Contacts", "Supplier Addresses And Contacts"]: + name = frappe.db.get_value("Desktop Icon", {"_report": report}) + if name: + frappe.db.set_value("Desktop Icon", name, "_report", "Addresses And Contacts") + + frappe.db.commit()