I'm using the Inventory
addon of Odoo 12 (but my problem could happen with any module).
In this addon, a StockMove
model has a move_line_ids
field.
In the Detailed Operations
dialog, we can see a tree view of all the move lines of the selected move.
If we click the Add a line
button, and set the fields, the values are stored in memory, but not in database unless we click the Confirm
button.
I would like to copy this behaviour in a @api.onchange()
method of my custom StockMove
model, but I don't find how to proceed.
If I use the self.move_line_ids.create()
method to create my new record, the move line will be stored in the database even if I don't click the Confirm
button.
Is there someone who managed to do that?
Thank you in advance!
And sorry if it is a duplicate question, but I did not found the answer to my question yet ><
The jzeta answer is working but breaks other Move
fields like reserved_availability
(always 0
) or quantity_done
(always 1
).
I am keeping jzeta as validated as the comments show the solution I was looking for.
Thank you a lot guys for your help!