Merge pull request #8882 from frappe/version-12
Merge Version-12 to develop
This commit is contained in:
commit
5ba9dba7e9
7 changed files with 47 additions and 16 deletions
|
|
@ -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()
|
||||
|
|
|
|||
|
|
@ -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.")
|
||||
}
|
||||
]
|
||||
},
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
||||
|
|
|
|||
|
|
@ -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'
|
||||
});
|
||||
}
|
||||
});
|
||||
|
|
@ -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
|
||||
|
||||
|
|
|
|||
|
|
@ -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' }
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
});
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue