Change Behaviours in DocType

Hi, i’m doing some modification in Production Order
and we get one that we don’t know how to solve.

Our customer doesn’t know how many products he will produce so he estimate, he
can produce more or less than he put on Qty field, but the Production Order is automatic and
finishes when the quantity produce is the same that was informed.

So we need to remove this behaviour to finish automaticaly and let the customer decide when the production finished

  1. We tried to use hooks, but hooks only added our behaviour after the whole code on method.

  2. We thought in extend the Production Order, make a copy of the Doctype and add in our app, but we saw
    that other DocTypes have links directly with the Production Order in Code.

  3. As a temporary solution we tried to change where the hooks add our behaviour and replace instead add, actually we could replace, but it was just more like a test and to not get totally stuck.

And as we could see (In principle) the method that sets status to “Complete” is get_status() in

So, we are following the wrong way trying to change this? How can we change that behaviour using our customized app ?

Can you explain this clearly, maybe using screenshots?

Of course :smiley:

Lets say that i have a production order in process:

So… we change the label “Quantity” for “Expected Quantity” and add a button “Finish Production Order” that only appears when the production order has some qty manufactured.

Now lets say that i finished the other 20, the production order would be this way

When i said about “finish automatically” is this, the “manufacture qty” is equal “expected” so the production order has it status changed to “Completed”

But as i said before, the customer can produce more then 50 in this case, so we need to remove this verification that changes the status.

I don’t think the production order system is designed to be hookable, you can either. You should submit a patch to either:

  1. Make it hookable
  2. Contribute the feature