# How to refresh because wizard modifies selected lines

**URL:** https://discuss.tryton.org/t/how-to-refresh-because-wizard-modifies-selected-lines/1830
**Category:** Developer
**Created:** [October 13, 2019, 8:13am UTC](https://discuss.tryton.org/t/how-to-refresh-because-wizard-modifies-selected-lines/1830 "2019-10-13T08:13:12Z")
**Posts on this page:** 8
**Page:** 1

<div class="post-metadata">

### Author: ![risto3](https://discuss-cdn.tryton.org/letter_avatar_proxy/v4/letter/r/a87d85/32.png) [@risto3](https://discuss.tryton.org/u/risto3)
#### Post date: [October 13, 2019, 8:13am UTC](https://discuss.tryton.org/t/how-to-refresh-because-wizard-modifies-selected-lines/1830/1 "2019-10-13T08:13:12Z")

</div>

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?

---

<div class="post-metadata">

### Author: ![risto3](https://discuss-cdn.tryton.org/letter_avatar_proxy/v4/letter/r/a87d85/32.png) [@risto3](https://discuss.tryton.org/u/risto3)
#### Post date: [October 13, 2019, 8:34am UTC](https://discuss.tryton.org/t/how-to-refresh-because-wizard-modifies-selected-lines/1830/2 "2019-10-13T08:34:27Z")

</div>

Found this [https://discuss.tryton.org/t/data-reloading-using-on-write-method](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]

---

<div class="post-metadata">

### Author: ![ced](https://discuss-cdn.tryton.org/user_avatar/discuss.tryton.org/ced/32/1237_2.png) [@ced](https://discuss.tryton.org/u/ced)
#### Post date: [October 16, 2019, 4:23pm UTC](https://discuss.tryton.org/t/how-to-refresh-because-wizard-modifies-selected-lines/1830/3 "2019-10-16T16:23:41Z")

</div>

Deleting active records in wizard is not supported.

---

<div class="post-metadata">

### Author: ![risto3](https://discuss-cdn.tryton.org/letter_avatar_proxy/v4/letter/r/a87d85/32.png) [@risto3](https://discuss.tryton.org/u/risto3)
#### Post date: [October 17, 2019, 9:14am UTC](https://discuss.tryton.org/t/how-to-refresh-because-wizard-modifies-selected-lines/1830/5 "2019-10-17T09:14:54Z")

</div>

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?

---

<div class="post-metadata">

### Author: ![ced](https://discuss-cdn.tryton.org/user_avatar/discuss.tryton.org/ced/32/1237_2.png) [@ced](https://discuss.tryton.org/u/ced)
#### Post date: [October 17, 2019, 10:56am UTC](https://discuss.tryton.org/t/how-to-refresh-because-wizard-modifies-selected-lines/1830/6 "2019-10-17T10:56:32Z")

</div>

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

---

<div class="post-metadata">

### Author: ![risto3](https://discuss-cdn.tryton.org/letter_avatar_proxy/v4/letter/r/a87d85/32.png) [@risto3](https://discuss.tryton.org/u/risto3)
#### Post date: [October 17, 2019, 12:35pm UTC](https://discuss.tryton.org/t/how-to-refresh-because-wizard-modifies-selected-lines/1830/7 "2019-10-17T12:35:57Z")

</div>

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.

---

<div class="post-metadata">

### Author: ![ced](https://discuss-cdn.tryton.org/user_avatar/discuss.tryton.org/ced/32/1237_2.png) [@ced](https://discuss.tryton.org/u/ced)
#### Post date: [October 17, 2019, 12:41pm UTC](https://discuss.tryton.org/t/how-to-refresh-because-wizard-modifies-selected-lines/1830/8 "2019-10-17T12:41:12Z")

</div>

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.

---

<div class="post-metadata">

### Author: ![ced](https://discuss-cdn.tryton.org/user_avatar/discuss.tryton.org/ced/32/1237_2.png) [@ced](https://discuss.tryton.org/u/ced)
#### Post date: [October 17, 2019, 4:20pm UTC](https://discuss.tryton.org/t/how-to-refresh-because-wizard-modifies-selected-lines/1830/9 "2019-10-17T16:20:47Z")

</div>

4 posts were split to a new topic: [How to manage invoice grouping](https://discuss.tryton.org/t/how-to-manage-invoice-grouping/1852)
