2017-06-22 10:48:12 +00:00
|
|
|
# Copyright (c) 2017, Frappe and Contributors
|
|
|
|
# License: GNU General Public License v3. See license.txt
|
|
|
|
|
|
|
|
from __future__ import unicode_literals
|
|
|
|
import frappe
|
|
|
|
|
|
|
|
def execute():
|
|
|
|
""" delete deprecated reports """
|
|
|
|
|
2017-06-28 07:54:44 +00:00
|
|
|
reports = [
|
|
|
|
"Monthly Salary Register", "Customer Addresses And Contacts",
|
|
|
|
"Supplier Addresses And Contacts"
|
|
|
|
]
|
2017-06-22 10:48:12 +00:00
|
|
|
|
|
|
|
for report in reports:
|
|
|
|
if frappe.db.exists("Report", report):
|
2017-06-28 07:54:44 +00:00
|
|
|
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()
|