* set the desktop icon while saving the domain settings * delete the custom icon only if the setup not completeversion-14
@@ -18,10 +18,11 @@ class Domain(Document): | |||||
self.setup_roles() | self.setup_roles() | ||||
self.setup_properties() | self.setup_properties() | ||||
self.set_values() | self.set_values() | ||||
if not int(frappe.db.get_single_value('System Settings', 'setup_complete') or 0): | |||||
# always set the desktop icons while changing the domain settings | |||||
self.setup_desktop_icons() | |||||
if not int(frappe.defaults.get_defaults().setup_complete or 0): | |||||
# if setup not complete, setup desktop etc. | # if setup not complete, setup desktop etc. | ||||
self.setup_sidebar_items() | self.setup_sidebar_items() | ||||
self.setup_desktop_icons() | |||||
self.set_default_portal_role() | self.set_default_portal_role() | ||||
if self.data.custom_fields: | if self.data.custom_fields: | ||||
@@ -15,7 +15,10 @@ class DomainSettings(Document): | |||||
self.save() | self.save() | ||||
def on_update(self): | def on_update(self): | ||||
for d in self.active_domains: | |||||
for i, d in enumerate(self.active_domains): | |||||
# set the flag to update the the desktop icons of all domains | |||||
if i >= 1: | |||||
frappe.flags.keep_desktop_icons = True | |||||
domain = frappe.get_doc('Domain', d.domain) | domain = frappe.get_doc('Domain', d.domain) | ||||
domain.setup_domain() | domain.setup_domain() | ||||
@@ -196,11 +196,13 @@ def set_desktop_icons(visible_list, ignore_duplicate=True): | |||||
if the desktop icon does not exist and the name is a DocType, then will create | if the desktop icon does not exist and the name is a DocType, then will create | ||||
an icon for the doctype''' | an icon for the doctype''' | ||||
# clear all custom | |||||
frappe.db.sql('delete from `tabDesktop Icon` where standard=0') | |||||
# clear all custom only if setup is not complete | |||||
if not int(frappe.defaults.get_defaults().setup_complete or 0): | |||||
frappe.db.sql('delete from `tabDesktop Icon` where standard=0') | |||||
# set all as blocked | |||||
frappe.db.sql('update `tabDesktop Icon` set blocked=0, hidden=1') | |||||
# set standard as blocked and hidden if setting first active domain | |||||
if not frappe.flags.keep_desktop_icons: | |||||
frappe.db.sql('update `tabDesktop Icon` set blocked=0, hidden=1 where standard=1') | |||||
# set as visible if present, or add icon | # set as visible if present, or add icon | ||||
for module_name in visible_list: | for module_name in visible_list: | ||||