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 am in Odoo 8. I'm searching the best way to cancel a stock move directly in my Odoo backend.
I don't want to use « update stock_move set state = 'draft' where id = ?; » in a sql query.
You're right to not want to do this via direct SQL, as you're ignoring a lot of other data validation steps that will cause errors in your data.
You could do this out of the box in OpenERP v7. In Odoo v8 this isn't possible without custom code due to how quants work. You'd need to override the existing action_cancel() function in the Python code to bypass the error for the done status, then undo changes to the quant the item came from.
What might be smarter and easier is to add a function to quickly create a new stock move that reverses the transaction. Basically, it needs to duplicate the original stock move, then swap the source and destination locations, and immediately finalize the move. This will also resolve the quant accuracy issue, and ensure that any accounting valuation entries are reversed as well.
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: 2/9/15, 6:36 AM|
|Seen: 1638 times|
|Last updated: 4/17/15, 6:57 AM|