Hide some buttons in Sales invoices

Hello,

i’m after disable bellow buttons in sales invoices. I wrote a client script by referring this https://docs.erpnext.com/docs/user/manual/en/hide-buttons-in-form-view. but didn’t work, could you please help me for this?

Thank you

image

@Vasana_Wijewardena add this in client script
onload_post_render(frm){
frm.remove_custom_button(‘Opportunity’, ‘Get Items From’);

},

@Vasana_Wijewardena you can use this script.

onload_post_render: frm => {
setTimeout(() => {
					frm.page.remove_inner_button('Opportunity', 'Get Items From');
			
				
			}, 2000);
}

Thank you

frappe.ui.form.on(‘Sales Invoice’, {
refresh(frm) {
frm.remove_custom_button(“Fetch Timesheet”, ‘Get Items From’);
})
does not work with me
just remove the fetch timesheet button

frappe.ui.form.on(‘Sales Invoice’, {
refresh(frm) {
frm.remove_custom_button(“Fetch Timesheet”);
frm.disable_button(“Get Items From”);
}
})
this is the write code

Need to bring this back on.

If I am unsing this code also the “Create” Button is missing on State “Paid”

rappe.ui.form.on('Sales Invoice', {
    refresh(frm) {
            frm.remove_custom_button('Fetch Timesheet');
             frm.disable_button('Preview');
            }
});

Therefor I was thinking about to check the state, but this is not working with buttons.

frappe.ui.form.on('Sales Invoice', {
    refresh(frm) {
            frm.remove_custom_button('Fetch Timesheet');
            if (frm.doc.state == "Draft") {
             frm.disable_button('Get Items From');
            }
        }
});

any ideas?

br
Andreas