In a precedent question, I was looking for the BaseModel.new
method to behave like the create
method from ORM, but without writing changes in the database.
Does the same method exist, but acting like unlink
? I would like to delete a record from my recordset in an onchange
call. I don't want the record to be delete at once, but only when the user will press the Save
button.
Thank you a lot in advance!
For more information about why I want this feature:
I am using the stock
module of Odoo. In a Picking
, I want to dynamically change the reserved products (tracked by unique serial number) which means add some new move_line
s and delete some of the existing ones.
I cannot simply change the lot_id
as some move_line
s with this lot_id
may be reserved in another Picking
(or at least, I didn't find how to do this neatly).
By changing the lot_id
or doing selected_move_id.move_line_ids.new({...})
in my onchange
method, I can add the new ones. Now I would like to delete the existing ones that I don't need anymore. I would like to delete them the same way as if the user would have press the trash
icon on the corresponding line.