From c65726bf079e0df2ab3477b92d17990d2e7e709e Mon Sep 17 00:00:00 2001 From: Rushabh Mehta Date: Fri, 15 Apr 2016 12:51:28 +0530 Subject: [PATCH] [patch] hide new icons if equivalent old ones are set --- erpnext/patches.txt | 1 + erpnext/patches/v7_0/fix_duplicate_icons.py | 21 +++++++++++++++++++ .../utilities/doctype/address/address.json | 3 ++- 3 files changed, 24 insertions(+), 1 deletion(-) create mode 100644 erpnext/patches/v7_0/fix_duplicate_icons.py diff --git a/erpnext/patches.txt b/erpnext/patches.txt index 125be6046d..469e327245 100644 --- a/erpnext/patches.txt +++ b/erpnext/patches.txt @@ -263,3 +263,4 @@ erpnext.patches.v6_24.rename_item_field erpnext.patches.v7_0.update_party_status erpnext.patches.v7_0.update_item_projected erpnext.patches.v6_20x.update_product_bundle_description +erpnext.patches.v7_0.fix_duplicate_icons diff --git a/erpnext/patches/v7_0/fix_duplicate_icons.py b/erpnext/patches/v7_0/fix_duplicate_icons.py new file mode 100644 index 0000000000..ee4c3e2058 --- /dev/null +++ b/erpnext/patches/v7_0/fix_duplicate_icons.py @@ -0,0 +1,21 @@ +import frappe + +from frappe.desk.doctype.desktop_icon.desktop_icon import (sync_desktop_icons, + get_desktop_icons, set_hidden) + +def execute(): + '''hide new style icons if old ones are set''' + sync_desktop_icons() + + for user in frappe.get_all('User', filters={'user_type': 'System User'}): + desktop_icons = get_desktop_icons(user.name) + icons_dict = {} + for d in desktop_icons: + if not d.hidden: + icons_dict[d.module_name] = d + + for key in (('Selling', 'Customer'), ('Stock', 'Item'), ('Buying', 'Supplier'), + ('HR', 'Employee'), ('CRM', 'Lead'), ('Support', 'Issue'), ('Projects', 'Project')): + if key[0] in icons_dict and key[1] in icons_dict: + set_hidden(key[1], user.name, 1) + diff --git a/erpnext/utilities/doctype/address/address.json b/erpnext/utilities/doctype/address/address.json index d1483680bd..558e0b78fc 100644 --- a/erpnext/utilities/doctype/address/address.json +++ b/erpnext/utilities/doctype/address/address.json @@ -644,7 +644,7 @@ "issingle": 0, "istable": 0, "max_attachments": 0, - "modified": "2016-04-06 05:39:46.951866", + "modified": "2016-04-15 03:09:31.497272", "modified_by": "Administrator", "module": "Utilities", "name": "Address", @@ -731,6 +731,7 @@ "write": 1 } ], + "quick_entry": 0, "read_only": 0, "read_only_onload": 0, "search_fields": "customer, supplier, sales_partner, country, state",