What is the best way to customize Work Order?

From what I am reading on Forums most people suggest using Custom Script. Please read further and let me know if such heavy customization can be handled by Custom Script (Client/Server).

I am asking because I am not able to get an ideas as to how to proceed…

Here is what I want to customize:

  1. Automate Stock movement when Work Order is Submitted. Meaning when user clicks on Submit button I want to add stock movement entry and submit it in background without the user having to interact with it. (Work Order)
  2. Allow user to reject items at Work Order level. Currently this does not seem to be possible. If it is possible I am ready to be educated on this.
  3. When a Work Order is submitted it automatically creates Job Cards based on operations associated to a BOM. But the problem here is that if we start Work Order with quantity to manufacture which is less then the target quantity it does not update the auto generated Job Cards which actually it should as per my understanding. So I will have to customize this part also.
  4. When a Work Order is submitted ERPNext shows a Start button which one has to click to see the finish button. Instead of this I just want to show the Finish button and when the user clicks on Finish button I want to ask for quantity finished.

Please guide me as appropriate.


1 Like

You will want to use server script create hooks into different events

For example for your problem 1. I will first create a custom app then i will create a method that does what you need to do. The method needs two arguments first the document and second the event name

then what I will do is go to the hooks.py look for doc_events if it exist or add it if not and enter something like this

doc_events = {
     "Work Order": {
             "on_submit": "custom_app.custom_method"

That means that the system on submit of the work order will call the method custom_app.custom_method and pass two arguments the first one is the document object (the work order currently being submitted) and the second one is the event name

Then a method that looks something like

in custom_app init.py

def custom_method(doc,event):
  do whatever here

Your method doesn’t need to return anything. doc is a reference to the work order being submitted so you can just change it directly

1 Like