How to hide view menu in customer form

Hi,
For our recordings I have created a user who will be responsible to create customers, and I want this user not to report the financial status of customers through view button (Accounts Receivable & Accounting Ledger) in customer card. How can I hide this option for the specific user/role?
Thanks.

Hi @Mehmet_Kavuran,

That for please apply custom/client script.
If use the role set in the condition then will hide the button from the customer doctype.

frappe.ui.form.on('Customer', {
    refresh: function(frm) {
        if (frappe.user_roles.indexOf("Sales User") ==-1) {
            frm.remove_custom_button('Accounts Receivable','View');
            frm.remove_custom_button('Accounting Ledger','View');
        }
    }
});

Please set your role and option according.
Then reload and check it.

Thank You!

4 Likes

Thanks @NCP