I have a wizard that updates and/or deletes some selected lines in a tree (in particular, invoices).
But if I delete any lines, I get messages to the tune that ‘You are trying to read records that don’t exist anymore’ when my wizard returns.
How to refresh/update the selected lines cleaning this up before returning ‘end’ in my transition_ function? I get the lines initially with Transaction.context[‘active_ids’].
Found this https://discuss.tryton.org/t/data-reloading-using-on-write-method
different, but the technique seems to work only partially for me…
I still get the above message sometimes but, if so, it is now only once, instead of multiple times.
strange…
[updated]
In the case in hand, there is no lost information.
Multiple invoices are merged into one, the empty ones simply need to be destroyed.
The reason a wizard is used instead of a simple action is the need to be able to order the draft invoices prior to the merge… (a draft invoice per delivery) but the final invoice multiple deliveries.
I guess once there is a delivery origin (as there should be), then reordering could be automatic by reference+date of the delivery.
For me, it is not a valid use case. We have some modules to deal with invoice grouping that does not require deletion.
More over, there is a lost of information by deleting the invoices. They can simply be canceled. Even if I do not consider this way of working as best practice.