# Sharing data between wizard StateView

**URL:** https://discuss.tryton.org/t/sharing-data-between-wizard-stateview/4582
**Category:** Developer
**Created:** [September 1, 2021, 5:34pm UTC](https://discuss.tryton.org/t/sharing-data-between-wizard-stateview/4582 "2021-09-01T17:34:47Z")
**Posts on this page:** 4
**Page:** 1

<div class="post-metadata">

### Author: ![DaZD](https://discuss-cdn.tryton.org/user_avatar/discuss.tryton.org/dazd/32/1502_2.png) [@DaZD](https://discuss.tryton.org/u/DaZD)
#### Post date: [September 1, 2021, 5:34pm UTC](https://discuss.tryton.org/t/sharing-data-between-wizard-stateview/4582/1 "2021-09-01T17:34:47Z")

</div>

Hi everyone,

In a wizard I need to know which intermediate objects have been created in order to delete them when the user click the cancel button. How can I store shared datas between the StateViews, and retrieve them in the end() function ?

In the [documentation](https://docs.tryton.org/projects/server/en/latest/topics/wizard.html#wizard) :

> The wizard stores data in `ir.session.wizard` between states.

But session.data is always empty whatever the state I’m in:

```auto
Session = pool.get('ir.session.wizard')
session = Session(self._session_id )
session.data

```

---

<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: [September 1, 2021, 8:51pm UTC](https://discuss.tryton.org/t/sharing-data-between-wizard-stateview/4582/2 "2021-09-01T20:51:47Z")

</div>

The wizards are not really designed for such behavior.  
Any way you can transfer data from one state to another by storing on the view as invisible field the required data using the default values.  
But you may think about just saving the record only once at the end in a single transaction.

---

<div class="post-metadata">

### Author: ![DaZD](https://discuss-cdn.tryton.org/user_avatar/discuss.tryton.org/dazd/32/1502_2.png) [@DaZD](https://discuss.tryton.org/u/DaZD)
#### Post date: [September 1, 2021, 11:28pm UTC](https://discuss.tryton.org/t/sharing-data-between-wizard-stateview/4582/3 "2021-09-01T23:28:16Z")

</div>

Thanks @ced  
Yes as you suggest I have recoded the process to save all once at the end. Way better.

---

<div class="post-metadata">

### Author: ![system](https://discuss-cdn.tryton.org/uploads/default/original/1X/c6f8ec0a40525cdcd50058c734283450a4b3d38b.png) [@system](https://discuss.tryton.org/u/system)
#### Post date: [October 1, 2021, 11:28pm UTC](https://discuss.tryton.org/t/sharing-data-between-wizard-stateview/4582/4 "2021-10-01T23:28:19Z")

</div>

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.
