set the desktop icon while saving the domain settings (#4657)
* set the desktop icon while saving the domain settings * delete the custom icon only if the setup not complete
This commit is contained in:
parent
8463937acd
commit
4e95459410
3 changed files with 13 additions and 7 deletions
|
|
@ -18,10 +18,11 @@ class Domain(Document):
|
|||
self.setup_roles()
|
||||
self.setup_properties()
|
||||
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.
|
||||
self.setup_sidebar_items()
|
||||
self.setup_desktop_icons()
|
||||
self.set_default_portal_role()
|
||||
|
||||
if self.data.custom_fields:
|
||||
|
|
|
|||
|
|
@ -15,7 +15,10 @@ class DomainSettings(Document):
|
|||
self.save()
|
||||
|
||||
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.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
|
||||
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
|
||||
for module_name in visible_list:
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue