Company DocType: Hide Sales report on top of company record

Hi,

in my current ERPNext installation, I have one company created. That company is used for all the projects we are managing.

For daily operations, I have set up multiple users that have “Projects User” role assigned. With that assignment, it gets the “Company - READ” permission.

Now my problem: When that particular Projects User opens the Company Document, it can see the report “Sales” on top of the company that shows the sales activities of the last 12 month.
I don’t want to show every user the sales report nor the fields “Monthly Sales target, / history etc.”

How can I disable that?

With the unwanted fields, I found a solution: - Set the permission level to 1 for the section “sales_settings”: This prevents the user from seeing the fields “Monthly Sales Target” etc.

But for the report I don’t find a solution. It seams that the report is specified here: erpnext/company_dashboard.py at develop · frappe/erpnext · GitHub

I tried the following:

  • Restrict the “READ” permission for Project Users: Then I get an error in the TimeSheet view (User is not allowed to view Company).

Any hints in the right direction?
Thx!

Just for the records: Using ERPNext 12.8

Is nobody having an idea how to fix this? Maybe could this be handled as a bug?

@paulator

add this custom script:

frappe.ui.form.on("Company", {
    onload: function(frm) {
        frm.dashboard.wrapper.parent().addClass("hide")
            .parent().find(".section-head").addClass("collapsed")
            .find(".octicon.collapse-indicator.octicon-chevron-up")
            .removeClass()
            .addClass("octicon collapse-indicator octicon-chevron-down") 
    }
})
1 Like

Thank you @Eli. I’ll give it a try.

Hi @Eli,

your script just collapses the section with the graph and does not remove it completely.
My intention was, to delete the graph at all for all users that don’t have the permission to read the sales data.

With your solution it is just collapsed and can be opened at anytime by the corresponding users.

Do you or anybody else have another solution?

Best regards,
-paulator

Hello @paulator

Did you find any solution?

I have the exact same issue and management don’t want to show that graph to all users

It comes back on reload company page.