Odoo is the world's easiest all-in-one management software. It includes hundreds of business apps:
CRM | e-Commerce | Accounting | Inventory | PoS | Project management | MRP | etc.
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
This platform is for beginners and experts willing to share their Odoo knowledge. It's not a forum to discuss ideas, but a knowledge base of questions and their answers.Register
Odoo Training Center
Access to our E-learning platform and experience all Odoo Apps through learning videos, exercises and Quizz.Test it now
|Asked: 12/18/14, 2:51 PM|
|Seen: 663 times|
|Last updated: 3/16/15, 8:10 AM|