Can we override Work Order Submit button actions?


Lately I am trying my hand on customization in ERPNext.

I am trying to find a way to override the code that is executed when we Submit a Work Order.

How can we do that?


Yogi Yang

Interesting concept…

However, if I were to instruct my developer team to do such a task, I would ask them to find a way to “hide” the original “Submit” button and add a new button that launches my new code.

This would preserve the original code of the core system and allow me to execute my own customizations without affecting the original core functions.

This could probably also be done within a custom app you could add to your installation.

I have (in the past) paid to alter core ERPNext code and have come to realize that once that is done, the future upgrades to the system will always be exponentially more difficult. However, doing such things through a custom add-on app really simplifies future upgrade work.

Just my opinion here, and as always… Your mileage may vary :sunglasses:



Have a look at override_doctype_class in

This gives you great powers as now everywhere frappe.get_doc() is called, it gets an instance of your custom class.

You can override core methods and decide when to call core code with super()

1 Like

Thanks for your extensive explanation. Actually I don’t want to replace original code. What I want to achieve is override Submit button event and replace some of its functionality with our own functionality.

Let me try to explain as to why we want this.

We are facing a problem in being able to reject some items produced at Work Order level and this short coming is preventing us from adopting ERPNext in our company.

We also tried the Inspection route but here also Inspection is either rejected or accepted for total quantity.

In this situation when some items are rejected we will need to update the quantity in the all following Work Orders and also store the quantity of Rejected items somewhere and this can only happen by customization.

Another thing is that we find the process of Starting a Work Order and then going to Job Card and starting and stopping a Job Card a bit too tedious & lengthy process, and looking at the amount of Work Orders that will get generated in our system it would result in productivity loss.

If there is any better approach then I am open to learn something new!!


Yogi Yang

Hello @bkm,

As I am new to this can you guide me as to how can I define something in my Custom App and merge it with existing functionality of ERPNext DocType?


Yogi Yang

Unfortunately… No.
I do not write any of my own apps. I pay developers to do it for me.