Disable "Update Items" Button for selected users

Hi,

I need support to write Custom Script for Disabling “Update Items” Button in Purchase Order for selected users.

I know! I’m not sure though that it can be done through a mere custom script? Or do you know if it can be done through custom scripting?

Thanks

Jay

Achieved this with below code:

frappe.ui.form.on(‘Purchase Order’, {
refresh(frm) {
if (frappe.user_roles.indexOf(“Purchase Manager”)!=-1 && (frappe.user_roles.indexOf(“Purchase User”)!=-1) && (frappe.user_roles.indexOf(“Stock User”)!=-1) && (frappe.user_roles.indexOf(“Stock Manager”)==-1)) {
{
setTimeout(() => {
frm.remove_custom_button(‘Update Items’);
}, 10);
}
}
}
})

3 Likes

Great! I will try this too!

Thanks much!

Jay