fix: patch to replace Project icon with Projects icon (#16374)

* Delete duplicate projects icon from desktop.py

* Fix patch (to replace project to projects)
This commit is contained in:
Suraj Shetty 2019-01-24 10:57:05 +05:30 committed by Faris Ansari
parent e415cce1a9
commit 41b3756df5
3 changed files with 17 additions and 24 deletions

View File

@ -135,13 +135,6 @@ def get_data():
"link": "leaderboard",
"label": _("Leaderboard")
},
{
"module_name": "Projects",
"color": "#8e44ad",
"icon": "octicon octicon-rocket",
"type": "module",
"hidden": 1
},
{
"module_name": "Support",
"color": "#2c3e50",

View File

@ -585,4 +585,5 @@ erpnext.patches.v11_0.renamed_from_to_fields_in_project
erpnext.patches.v12_0.change_qms_icon
erpnext.patches.v12_0.rename_learn_to_help
erpnext.patches.v12_0.rename_accounts_desktop_icon_to_accounting
erpnext.patches.v12_0.replace_project_list_desktop_icon_with_projects_module_desktop_icon
erpnext.patches.v12_0.replace_project_list_desktop_icon_with_projects_module_desktop_icon # 09-01-2019
erpnext.patches.v11_0.rename_additional_salary_component_additional_salary

View File

@ -1,24 +1,23 @@
import frappe
def execute():
frappe.db.sql("""DELETE
FROM `tabDesktop Icon`
WHERE
`module_name` in ('Project', 'Projects') AND
`standard`=1 AND
`app`='erpnext'
""")
projects_icons = frappe.get_all('Desktop Icon', filters={
'module_name': ['in', ('Project', 'Projects')],
})
desktop_icon = frappe.get_doc({
'doctype': 'Desktop Icon',
'idx': 5,
'standard': 1,
'app': 'erpnext',
'owner': 'Administrator',
fields_to_update = {
'module_name': 'Projects',
'color': '#8e44ad',
'icon': 'octicon octicon-rocket',
'type': 'module'
})
'type': 'module',
'link': ''
}
desktop_icon.save()
for icon in projects_icons:
icon_doc = frappe.get_doc('Desktop Icon', icon.name)
icon_doc.update(fields_to_update)
try:
icon_doc.save()
except frappe.exceptions.UniqueValidationError:
# delete duplicate icon
icon_doc.delete()