From 28fd02e4a86dfa4f0b6fc06217fb436f0323dd00 Mon Sep 17 00:00:00 2001 From: Ameya Shenoy Date: Wed, 19 Sep 2018 13:15:52 +0530 Subject: [PATCH] fix(desktop_icon): remove land unit icon if exists (#15430) * fix(desktop_icon): remove land unit icon if exists Patch to delete the 'Land Unit' icon form 'Desktop Icon' doctype if exists, since 'Land Unit' has been merged with 'Location' Signed-off-by: Ameya Shenoy * Update remove_land_unit_icon.py --- erpnext/patches.txt | 1 + erpnext/patches/v11_0/remove_land_unit_icon.py | 17 +++++++++++++++++ 2 files changed, 18 insertions(+) create mode 100644 erpnext/patches/v11_0/remove_land_unit_icon.py diff --git a/erpnext/patches.txt b/erpnext/patches.txt index 10dd2618440..8c18d14d29f 100644 --- a/erpnext/patches.txt +++ b/erpnext/patches.txt @@ -565,3 +565,4 @@ erpnext.patches.v11_0.make_job_card erpnext.patches.v11_0.redesign_healthcare_billing_work_flow erpnext.patches.v10_0.delete_hub_documents # 12-08-2018 erpnext.patches.v11_0.rename_healthcare_fields +erpnext.patches.v11_0.remove_land_unit_icon diff --git a/erpnext/patches/v11_0/remove_land_unit_icon.py b/erpnext/patches/v11_0/remove_land_unit_icon.py new file mode 100644 index 00000000000..98051cc7f11 --- /dev/null +++ b/erpnext/patches/v11_0/remove_land_unit_icon.py @@ -0,0 +1,17 @@ +# Copyright (c) 2018, Frappe and Contributors +# License: GNU General Public License v3. See license.txt + +# imports - module imports +import frappe + + +def execute(): + """ + Delete the "Land Unit" doc if exists from "Desktop Icon" doctype + """ + try: + doc = frappe.get_doc('Desktop Icon', {'standard': 1, 'module_name': 'Land Unit'}) + frappe.delete_doc('Desktop Icon', doc.name) + except frappe.ValidationError: + # The 'Land Unit' doc doesn't exist, nothing to do + pass