I would like to write a bit of Python code in a Server Action that will finish production on a manufacturing order. The action should update all the necessary fields and the inventory -- just as if the user pressed the 'Produce' button in the manufacturing orders UI.
Is there a way to achieve the same result as pressing the 'Produce' button, but through Python code?
There is, you just need to find the correct methods and workflow action for this. Look up the workflow (XML file) for the MRP module and see what states are called.
If you are using OpenERP 7, it would be something like this:
netsvc.LocalService("workflow").trg_trigger(uid, 'account.move.line', id, cr)
Don't know if this is the same for Odoo 8.0 and up. Didn't check that one yet.
Turn on your developer mode to see what menu's and buttons a user would normally call, and simulate the process in code.
Please try to give a substantial answer. If you wanted to comment on the question or answer, just use the commenting tool. Please remember that you can always revise your answers - no need to answer the same question twice. Also, please don't forget to vote - it really helps to select the best questions and answers!
About This Community
|Asked: 12/18/14, 2:51 PM|
|Seen: 601 times|
|Last updated: 3/16/15, 8:10 AM|