diff --git a/frappe/__init__.py b/frappe/__init__.py index 1ee5db416b..18ec5c0ee7 100644 --- a/frappe/__init__.py +++ b/frappe/__init__.py @@ -23,7 +23,7 @@ if sys.version[0] == '2': reload(sys) sys.setdefaultencoding("utf-8") -__version__ = '12.0.17' +__version__ = '12.0.20' __title__ = "Frappe Framework" local = Local() diff --git a/frappe/config/settings.py b/frappe/config/settings.py index 2422f2fae2..a0a7dcd65f 100644 --- a/frappe/config/settings.py +++ b/frappe/config/settings.py @@ -1,4 +1,5 @@ from __future__ import unicode_literals +import frappe from frappe import _ from frappe.desk.moduleview import add_setup_section @@ -88,7 +89,7 @@ def get_data(): ] }, { - "label": _("Email"), + "label": _("Email / Notifications"), "icon": "fa fa-envelope", "items": [ { @@ -120,6 +121,12 @@ def get_data(): "type": "doctype", "name": "Newsletter", "description": _("Create and manage newsletter") + }, + { + "type": "doctype", + "route": "Form/Notification Settings/{}".format(frappe.session.user), + "name": "Notification Settings", + "description": _("Configure notifications for mentions, assignments, energy points and more.") } ] }, diff --git a/frappe/desk/doctype/notification_log/notification_log.py b/frappe/desk/doctype/notification_log/notification_log.py index 87bfc1ca17..398a3de351 100644 --- a/frappe/desk/doctype/notification_log/notification_log.py +++ b/frappe/desk/doctype/notification_log/notification_log.py @@ -42,7 +42,6 @@ def enqueue_create_notification(users, doc): This breaks new site creation if Redis server is not running. We do not need any notifications in fresh installation ''' - if frappe.flags.in_install: return diff --git a/frappe/desk/doctype/notification_settings/notification_settings.js b/frappe/desk/doctype/notification_settings/notification_settings.js new file mode 100644 index 0000000000..d4e3b08def --- /dev/null +++ b/frappe/desk/doctype/notification_settings/notification_settings.js @@ -0,0 +1,12 @@ +// Copyright (c) 2019, Frappe Technologies and contributors +// For license information, please see license.txt + +frappe.ui.form.on('Notification Settings', { + onload: () => { + frappe.breadcrumbs.add({ + label: __('Settings'), + route: '#modules/Settings', + type: 'Custom' + }); + } +}); diff --git a/frappe/desk/moduleview.py b/frappe/desk/moduleview.py index c5e5ea7c2b..0bad171b04 100644 --- a/frappe/desk/moduleview.py +++ b/frappe/desk/moduleview.py @@ -234,8 +234,11 @@ def get_config(app, module): for item in section["items"]: if item["type"]=="report" and item["name"] in disabled_reports: continue + # some module links might not have name + if not item.get("name"): + item["name"] = item.get("label") if not item.get("label"): - item["label"] = _(item["name"]) + item["label"] = _(item.get("name")) items.append(item) section['items'] = items @@ -297,7 +300,7 @@ def get_onboard_items(app, module): @frappe.whitelist() def get_links_for_module(app, module): - return [l.get('label') for l in get_links(app, module)] + return [{'value': l.get('name'), 'label': l.get('label')} for l in get_links(app, module)] def get_links(app, module): try: @@ -330,13 +333,13 @@ def get_desktop_settings(): def apply_user_saved_links(module): module = frappe._dict(module) all_links = get_links(module.app, module.module_name) - module_links_by_label = {} + module_links_by_name = {} for link in all_links: - module_links_by_label[link['label']] = link + module_links_by_name[link['name']] = link if module.module_name in user_saved_links_by_module: user_links = frappe.parse_json(user_saved_links_by_module[module.module_name]) - module.links = [module_links_by_label[l] for l in user_links if l in module_links_by_label] + module.links = [module_links_by_name[l] for l in user_links if l in module_links_by_name] return module diff --git a/frappe/public/js/frappe/views/components/DeskModuleBox.vue b/frappe/public/js/frappe/views/components/DeskModuleBox.vue index 355a447475..0d809508ee 100644 --- a/frappe/public/js/frappe/views/components/DeskModuleBox.vue +++ b/frappe/public/js/frappe/views/components/DeskModuleBox.vue @@ -63,7 +63,7 @@ export default { } }, dropdown_links() { - return this.links.length > 0 ? this.links + return this.type === 'module' ? this.links .filter(link => !link.hidden) .concat([ { label: __('Customize'), action: () => this.$emit('customize'), class: 'border-top' } diff --git a/frappe/public/js/frappe/views/components/DeskSection.vue b/frappe/public/js/frappe/views/components/DeskSection.vue index 9b24f75294..83670a3e82 100644 --- a/frappe/public/js/frappe/views/components/DeskSection.vue +++ b/frappe/public/js/frappe/views/components/DeskSection.vue @@ -26,7 +26,8 @@ export default { }, data() { return { - dragging: false + dragging: false, + fetched_module_links: {} } }, mounted() { @@ -53,6 +54,7 @@ export default { }) }, show_module_card_customize_dialog(module) { + const me = this; const d = new frappe.ui.Dialog({ title: __('Customize Shortcuts'), fields: [ @@ -60,11 +62,19 @@ export default { label: __('Shortcuts'), fieldname: 'links', fieldtype: 'MultiSelectPills', - get_data() { - return frappe.call('frappe.desk.moduleview.get_links_for_module', { - app: module.app, - module: module.module_name, - }).then(r => r.message); + get_data: () => { + const module_links = me.fetched_module_links[module.module_name]; + if (!module_links) { + return frappe.xcall('frappe.desk.moduleview.get_links_for_module', { + app: module.app, + module: module.module_name, + }).then(links => { + me.fetched_module_links[module.module_name] = links; + return links; + }); + } else { + return module_links; + } }, default: module.links.filter(l => !l.hidden).map(l => l.name) } @@ -73,7 +83,7 @@ export default { primary_action: ({ links }) => { frappe.call('frappe.desk.moduleview.update_links_for_module', { module_name: module.module_name, - links + links: links || [] }).then(r => { this.$emit('update-desktop-settings', r.message); });