2015-03-03 09:25:30 +00:00
|
|
|
# Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors
|
2015-02-17 09:07:45 +00:00
|
|
|
# License: GNU General Public License v3. See license.txt
|
|
|
|
|
2019-01-22 12:52:20 +00:00
|
|
|
from __future__ import unicode_literals
|
2015-02-17 09:07:45 +00:00
|
|
|
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)
|
|
|
|
|