How to disable the action in sales invoice

how to disable the action in sales invoice like the submit and rejected
the actions based in workflow
when some if condition
like the user is admin

frappe.ui.form.on('Sales Invoice', {
	refresh(frm) {
		if (frappe.session.user != "Administrator") {
            // frm.enable_save();
        } else {
            // frm.disable_save();
             setTimeout(() => {
                       frm.remove_custom_button('Actions', 'Help');
                       frm.remove_custom_button('Actions', 'Draft');
                       frm.remove_custom_button("Actions");
       },700);
        }
	}
})

image

Please check the reference.

i want to disable not to remove

What is the difference between disable and remove? The logic seems to be the same. you have to set the “if condition”

what is the benefit of the Hidden and Read Only in doctype?

  • Hidden: This setting makes a field invisible on the form. Use it to hide information that users don’t need to see or interact with directly. This can simplify the form and reduce distractions.
  • Read Only: This setting makes a field visible but not editable. Use it to display important information that users should see but not change, such as a calculated total or a status field.

I want the UI no change
like add or remove some button

Only have an option.