ERPNext.com Frappe Cloud Support Partners Foundation Frappe School

Overriding Buttons

Hi there,

I want to override how the button on work order creation works and I’m wondering if this is possible.

In Sales Order, there is a “Create” button and from there is “Work Order”. I want to override it with a specific functionality.

First thing I tried is to add a custom button in my custom script with the same name but it looks like instead of overwriting it just adds the button.

Wondering if anyone have encountered this before?

image

My solution for this has always been to remove the custom button and add my own back, often with the same title.

frm.remove_custom_button("Purchase Order", "Create")
frm.add_custom_button(
    "<b>Purchase Order</b>",
    () => { 
         custom_po_creation_function(frm)
    },
     "Create"
)
1 Like