Unable to Hide button in Purchase Invoice using Custom Script

Hello,

I am using the below Script to hide the Payment Request Button in Purchase Invoice, but unable to do it.

frappe.ui.form.on(‘Purchase Invoice’, {
refresh(frm) {
setTimeout(() => {

    frm.remove_custom_button('Payment Request','Create');

    }, 10);
}

})

Can anyone please confirm if this is correct?

Best Regards,
Kartive

@Kartive_lfc

This should work:

frappe.ui.form.on('Purchase Invoice', {                          
    onload_post_render: function(frm){                      
        frm.page.remove_inner_button('Payment Request', 'Create')
        }
    }
);
1 Like