fix(desk_settings): check json none case
This commit is contained in:
parent
10030e5fcb
commit
01f3e38c8e
2 changed files with 17 additions and 20 deletions
|
|
@ -16,20 +16,23 @@ def get_modules_from_all_apps_for_user(user=None):
|
|||
|
||||
empty_tables_by_module = get_all_empty_tables_by_module()
|
||||
|
||||
home_settings = json.loads(frappe.db.get_value("User", frappe.session.user, 'home_settings'))
|
||||
home_settings = frappe.db.get_value("User", frappe.session.user, 'home_settings')
|
||||
if home_settings:
|
||||
home_settings = json.loads(home_settings)
|
||||
|
||||
for module in allowed_modules_list:
|
||||
module_name = module["module_name"]
|
||||
if module_name in empty_tables_by_module:
|
||||
module["onboard_present"] = 1
|
||||
|
||||
category_settings = home_settings[module["category"]]
|
||||
if module_name not in category_settings:
|
||||
module["hidden"] = 1
|
||||
else:
|
||||
links = category_settings[module_name]["links"]
|
||||
if links:
|
||||
module["links"] = get_module_link_items_from_list(module["app"], module_name, links.split(","))
|
||||
if home_settings:
|
||||
category_settings = home_settings[module["category"]]
|
||||
if module_name not in category_settings:
|
||||
module["hidden"] = 1
|
||||
else:
|
||||
links = category_settings[module_name]["links"]
|
||||
if links:
|
||||
module["links"] = get_module_link_items_from_list(module["app"], module_name, links.split(","))
|
||||
|
||||
return allowed_modules_list
|
||||
|
||||
|
|
|
|||
|
|
@ -1,15 +1,12 @@
|
|||
function generate_route(item, module_name) {
|
||||
function generate_route(item) {
|
||||
if(item.type==="doctype") {
|
||||
item.doctype = item.name;
|
||||
// // map of doctypes that belong to a module
|
||||
// frappe.module_links[module_name].push(item.name);
|
||||
}
|
||||
let route = '';
|
||||
if(!item.route) {
|
||||
if(item.link) {
|
||||
route=strip(item.link, "#");
|
||||
}
|
||||
else if(item.type==="doctype") {
|
||||
} else if(item.type==="doctype") {
|
||||
if(frappe.model.is_single(item.doctype)) {
|
||||
route = 'Form/' + item.doctype;
|
||||
} else {
|
||||
|
|
@ -18,14 +15,11 @@ function generate_route(item, module_name) {
|
|||
}
|
||||
route="List/" + item.doctype;
|
||||
}
|
||||
}
|
||||
else if(item.type==="report" && item.is_query_report) {
|
||||
} else if(item.type==="report" && item.is_query_report) {
|
||||
route="query-report/" + item.name;
|
||||
}
|
||||
else if(item.type==="report") {
|
||||
} else if(item.type==="report") {
|
||||
route="List/" + item.doctype + "/Report/" + item.name;
|
||||
}
|
||||
else if(item.type==="page") {
|
||||
} else if(item.type==="page") {
|
||||
route=item.name;
|
||||
}
|
||||
|
||||
|
|
@ -46,4 +40,4 @@ function generate_route(item, module_name) {
|
|||
|
||||
export {
|
||||
generate_route
|
||||
}
|
||||
};
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue