ERPNext Foundation ERPNext Cloud Chat Blog Discuss Frappé* Donate

Hide Dashboard By Default


#1

When I open a project to manage tasks it always displays the Dashboard in the Down or Visible position.

I do not want that to be the default behavior. I want the default to be hidden unless I select the icon.

I have also noticed when I hide the dashboard and then Save a record the dashboard re-appears.

How can I do this?

Thanks.

Jay


Permission for view tasks under project?
#2

put this code in your custom script of that doctype

cur_frm.dashboard.frm.fields[0].df.collapsible=0


#3

can i hide the dashboard from a specific user


#4

Yes, check the user and hide the dashboard in custom script.


#5

where i can check the user and write custom script in doctype


#6

@M.Ashraf

You can get userid from session. Based on userid fetch information and hide dashboard.


#7

ok how to hide not only collapse ??


#8

cur_frm.dashboard.frm.fields[0].df.hidden=1


#9

Thank you . It works !


#10

i`m trying to make only system admins and accounting are able to see dashboard

so i started with this

frappe.ui.form.on(“Project”, “onload”, function(frm, cdt, cdn) {
if (frappe.user_info(email_id) != “m.ashraf@erpnext.systems”) {
cur_frm.dashboard.frm.fields[0].df.hidden=1;
} });

but it desnt work any user can see the dashboard ??


#11

i also tried this

cur_frm.cscript.custom_validate = function(doc) {
if(frappe.user_roles.indexOf(“Accounts Manager”) == -1) {
cur_frm.dashboard.frm.fields[0].df.hidden=1;
frappe.validated = false;
}
}

but also not working


#12

ok finally made it by

if(!in_list(cur_frm.user_roles,“Dashboard”))
{
cur_frm.dashboard.frm.fields[0].df.hidden=1;
}

and created a new role ‘Dashboard’ then assigned it to all profiles that we don`t want to make them see the dashboard


#13

thanks for ur contribution but try this still not working dashboard hide from all user


#14

share your script


#15

i take script from @Mahmoud_Ghoneem

if(!in_list(cur_frm.user_roles,“Dashboard”))
{
cur_frm.dashboard.frm.fields[0].df.hidden=1;
}


#16

yes !!

Also to me it hidden the dashboard for the entire system users