# How to generate a wizard in rst scenario

**URL:** <https://discuss.tryton.org/t/how-to-generate-a-wizard-in-rst-scenario/3523>\
**Category:** Developer\
**Created:** [December 5, 2020, 6:34am UTC](https://discuss.tryton.org/t/how-to-generate-a-wizard-in-rst-scenario/3523 "2020-12-05T06:34:26Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![sangeetatarkar](https://discuss-cdn.tryton.org/letter_avatar_proxy/v4/letter/s/b3f665/32.png) [@sangeetatarkar](https://discuss.tryton.org/u/sangeetatarkar)\
**Post date:** [December 5, 2020, 6:34am UTC](https://discuss.tryton.org/t/how-to-generate-a-wizard-in-rst-scenario/3523/1 "2020-12-05T06:34:26Z")

</div>

WizPayVoucher using wizard::

```auto
    >>> generate_cheque = Wizard('wiz.pay_automation', models=[voucher])

```

```auto
File "/home/vam/workspace/tryton/tryton50/lib/python3.8/site-packages/trytond_pay_automation-5.0.0-py3.8.egg/trytond/modules/pay_automation/tests/pay.rst", line 125, in pay.rst
Failed example:
    generate_cheque = Wizard('wiz.pay_automation', models=[voucher])
Exception raised:
    Traceback (most recent call last):
      File "/usr/lib/python3.8/doctest.py", line 1336, in __run
        exec(compile(example.source, filename, "single",
      File "<doctest pay.rst[60]>", line 1, in <module>
        generate_cheque = Wizard('wiz.pay_automation', models=[voucher])
      File "/home/vam/workspace/tryton/tryton50/lib/python3.8/site-packages/proteus/ __init__.py", line 1207, in __init__
        self.execute(self.start_state)
      File "/home/vam/workspace/tryton/tryton50/lib/python3.8/site-packages/proteus/ __init__.py", line 1233, in execute
        result = self._proxy.execute(self.session_id, data, self.state,
      File "/home/vam/workspace/tryton/tryton50/lib/python3.8/site-packages/proteus/config.py", line 188, in __call__
        result = rpc.result(meth(*args, **kwargs))
      File "/home/vam/workspace/tryton/tryton50/lib/python3.8/site-packages/trytond/wizard/wizard.py", line 292, in execute
        return wizard._execute(state_name)
      File "/home/vam/workspace/tryton/tryton50/lib/python3.8/site-packages/trytond/wizard/wizard.py", line 302, in _execute
        view = state.get_view(self, state_name)
      File "/home/vam/workspace/tryton/tryton50/lib/python3.8/site-packages/trytond/wizard/wizard.py", line 81, in get_view
        return Model_.fields_view_get(view_id=view_id, view_type='form')
      File "/home/vam/workspace/tryton/tryton50/lib/python3.8/site-packages/trytond/model/modelview.py", line 346, in fields_view_get
        xarch, xfields = cls._view_look_dom_arch(tree, result['type'],
      File "/home/vam/workspace/tryton/tryton50/lib/python3.8/site-packages/trytond/model/modelview.py", line 406, in _view_look_dom_arch
        if not ModelAccess.check_relation(cls. __name__ , name, mode='read'):
      File "/home/vam/workspace/tryton/tryton50/lib/python3.8/site-packages/trytond/ir/model.py", line 538, in check_relation
        field.get_target(). __name__ , mode=mode,
      File "/home/vam/workspace/tryton/tryton50/lib/python3.8/site-packages/trytond/model/fields/many2many.py", line 273, in get_target
        Relation = Pool().get(self.relation_name)
      File "/home/vam/workspace/tryton/tryton50/lib/python3.8/site-packages/trytond/pool.py", line 177, in get
        return self._pool[self.database_name][type][name]
    KeyError: 'cheque.details'

```

---

<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:** [December 5, 2020, 11:08am UTC](https://discuss.tryton.org/t/how-to-generate-a-wizard-in-rst-scenario/3523/2 "2020-12-05T11:08:13Z")

</div>

You are instantiate correctly the wizard. The problem is that you did not register in the pool the model `cheque.details` which is used on the first view of the wizard.
