Remove or hide Button from form view

Hi All

I’m tired of removing or hiding the button from the form view, but it’s no use
how to solve this

frappe.ui.form.on('Sales Order', {
    refresh(frm) {
    setTimeout(() => {
        frm.remove_custom_button('Update Items');
        frm.remove_custom_button('Close', 'Status');
        frm.remove_custom_button('Work Order', 'Make');
        }, 10);
    }
})

Try This:

frappe.ui.form.on('Sales Order', {
	refresh(frm) {
	    setTimeout(() => {
        frm.remove_custom_button('Update Items');
        frm.remove_custom_button('Close', "Status");
        frm.remove_custom_button('Work Order', "Create");
        }, 10);
		
	}
})

I’ve tried this to hide the PDF button from quotation and sales order print preview page but its not working.

No, that I do not know, I have not tried yet.

Would love to find the solution to this. No idea why… but remove_custom_button works on the “Customer” doctype, but not my “Sales Invoice” doctype :confused:

ahh ok. this actually works… just needed to increase my timeout to 1000. Not sure why the timeout isn’t required for my “Customer” doctype though, only “Sales Invoice”.