Disable ability to send emails from docType based on workflow status

Hi all,

Using a client I would like to remove the ability to email on a document until it has moved to a certain point in the workflow that I’ve made.

image

I’m imagining the way to approach this is remove options from the menu using something like:

frappe.ui.form.on('docType', {
	onload(frm) {
    if(frm.doc.doc_status ___is in___list_of_statuses){
        cur_frm.page.remove_inner_button(__('Email'),  __('...'));
       }
    }
})

Any ideas? I have a feeling that the 3-dots button might not be targetable by page.remove_inner_button.

Thanks

Hi @Andy_Jones,

So you can apply a client/custom script for that.
Please apply and check it.

frappe.ui.form.on('Your DocType', {
	refresh(frm) {
	    if(frm.doc.docstatus != 1){
		frm.page.menu.find('[data-label="Menu"],[data-label="Email"]').parent().parent().remove();
	    }
	}
});

Please set your workflow condition according to.

Thank You!

1 Like

That worked perfectly. Thank you.