Sharing data between wizard StateView

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 :

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

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

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

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.

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