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
1 Like
put this code in your custom script of that doctype
cur_frm.dashboard.frm.fields[0].df.collapsible=0
7 Likes
can i hide the dashboard from a specific user
Yes, check the user and hide the dashboard in custom script.
1 Like
where i can check the user and write custom script in doctype
@M.Ashraf
You can get userid from session. Based on userid fetch information and hide dashboard.
1 Like
ok how to hide not only collapse ??
cur_frm.dashboard.frm.fields[0].df.hidden=1
2 Likes
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 ??
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
1 Like
thanks for ur contribution but try this still not working dashboard hide from all user
i take script from @Mahmoud_Ghoneem
if(!in_list(cur_frm.user_roles,âDashboardâ))
{
cur_frm.dashboard.frm.fields[0].df.hidden=1;
}
1 Like
yes !!
Also to me it hidden the dashboard for the entire system users
Alternatively, you could use CSS to achieve it, we have a custom CSS that has this included:
.form-links.form-dashboard-section {
display:none;
}
wale
18
Hi ,
Just for the records, I believe the correct script should be something like:
if(!(frappe.user.has_role(['Dashboard'])))
{
cur_frm.dashboard.frm.fields[0].df.hidden=1;
}
Cheers!
3 Likes
Hello,
can you tell me where i have to put this custom script⌠can you please show
@shanigaram_kartheek You can add it in custom script doctype in your instant:
https://docs.erpnext.com/docs/user/manual/en/customize-erpnext/custom-scripts
or in JS folder inside your custom App
1 Like