How does a Work Order "complete" ONLY AFTER the Manufacture Stock Entry submit?

I would like to implement, on another DocType, some special functionality that I see in Work Orders.

When I click Finish on a Work Order, it generates and then sends my browser to, a “Manufacture” type Stock Entry.
After that, the Work Order will refuse to complete until I complete and submit the Stock Entry.

Is this behavior written into the Work Order source code, or does some sort of generic events/scheduling capability make that happen?


I haven’t looked at the Work Order code specifically, but this kind of thing would generally be done with normal lifecycle hooks. In the Work Order’s before_submit hook, you’d check to see if the right kind of Stock Entry exists. Then, in the Stock Entry’s on_submit hook, you’d do whatever kind of transformation/status-update you needed in the Work Order. The connection would be made with a link field from the Stock Entry pointing to the Work Order.

Would that serve your needs?



Got it! Even if that’s not how the WO does it, it’s certainly viable for the thing I’m trying to achieve.

Very much appreciated. Thank you!