How to refresh because wizard modifies selected lines

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’].

Example somewhere?

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]

Deleting active records in wizard is not supported.

Hmm, what would be needed to support such an operation?

Alternately, as a workaround, would it be possible to queue up deletion of the records upon return from the wizard?

I do not think it is a desirable behavior. We should not encourage deleting records in wizard because it is a lost of information.

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.

4 posts were split to a new topic: How to manage invoice grouping