[fix] add CRM module to user desktop items in patch
diff --git a/erpnext/patches.txt b/erpnext/patches.txt
index d1955f2..f7e7849 100644
--- a/erpnext/patches.txt
+++ b/erpnext/patches.txt
@@ -108,7 +108,6 @@
erpnext.patches.v5_0.update_companywise_payment_account
erpnext.patches.v5_0.remove_birthday_events
erpnext.patches.v5_0.update_item_name_in_bom
-execute:frappe.reload_doc('crm', 'doctype', 'lead')
-execute:frappe.reload_doc('crm', 'doctype', 'opportunity')
+erpnext.patches.v5_0.new_crm_module
erpnext.patches.v5_0.rename_customer_issue
erpnext.patches.v5_0.update_material_transfer_for_manufacture
diff --git a/erpnext/patches/v5_0/new_crm_module.py b/erpnext/patches/v5_0/new_crm_module.py
new file mode 100644
index 0000000..ecf20e5
--- /dev/null
+++ b/erpnext/patches/v5_0/new_crm_module.py
@@ -0,0 +1,24 @@
+# Copyright (c) 2015, Web Notes Technologies Pvt. Ltd. and Contributors
+# License: GNU General Public License v3. See license.txt
+
+import json
+import frappe
+
+def execute():
+ frappe.reload_doc('crm', 'doctype', 'lead')
+ frappe.reload_doc('crm', 'doctype', 'opportunity')
+
+ add_crm_to_user_desktop_items()
+
+def add_crm_to_user_desktop_items():
+ key = "_user_desktop_items"
+ for user in frappe.get_all("User", filters={"enabled": 1, "user_type": "System User"}):
+ user = user.name
+ user_desktop_items = frappe.db.get_defaults(key, parent=user)
+ if user_desktop_items:
+ user_desktop_items = json.loads(user_desktop_items)
+ if "CRM" not in user_desktop_items:
+ user_desktop_items.append("CRM")
+ frappe.db.set_default(key, json.dumps(user_desktop_items), parent=user)
+
+