fix: patches were breaking while migrating (#27205)
* fix: patches were breaking while migrating (#27195)
* fix: patches were breaking while migrating
* fix: Removed duplicate function
Co-authored-by: Nabin Hait <nabinhait@gmail.com>
(cherry picked from commit 17e0fa7a8b)
# Conflicts:
# erpnext/patches.txt
* fix: resolve conflicts
Co-authored-by: Shadrak Gurupnor <30501401+shadrak98@users.noreply.github.com>
Co-authored-by: Ankush Menat <ankush@iwebnotes.com>
This commit is contained in:
@@ -13,6 +13,7 @@ def execute():
|
||||
for report in reports_to_delete:
|
||||
if frappe.db.exists("Report", report):
|
||||
delete_auto_email_reports(report)
|
||||
check_linked_reports(report)
|
||||
|
||||
frappe.delete_doc("Report", report)
|
||||
|
||||
@@ -21,3 +22,13 @@ def delete_auto_email_reports(report):
|
||||
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])
|
||||
|
||||
def check_linked_reports(report):
|
||||
""" Check if reports are referenced in Desktop Icon """
|
||||
icons = frappe.get_all("Desktop Icon",
|
||||
fields = ['name'],
|
||||
filters = {
|
||||
"_report": report
|
||||
})
|
||||
if icons:
|
||||
frappe.delete_doc("Desktop Icon", icons)
|
||||
Reference in New Issue
Block a user