# Error when email\_print from a "form\_print" keyword with wizard

**URL:** <https://discuss.tryton.org/t/error-when-email-print-from-a-form-print-keyword-with-wizard/1972>\
**Category:** Developer\
**Created:** [November 18, 2019, 4:31pm UTC](https://discuss.tryton.org/t/error-when-email-print-from-a-form-print-keyword-with-wizard/1972 "2019-11-18T16:31:20Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![sergyo](https://discuss-cdn.tryton.org/user_avatar/discuss.tryton.org/sergyo/32/181_2.png) [@sergyo](https://discuss.tryton.org/u/sergyo)\
**Post date:** [November 18, 2019, 4:31pm UTC](https://discuss.tryton.org/t/error-when-email-print-from-a-form-print-keyword-with-wizard/1972/1 "2019-11-18T16:31:20Z")

</div>

I’m configuring the email\_print functionality for a couple of reports. This works after:

- create email field function on model
- add email field to view
- define “email” data (“email\_pyson”) on action report, for instance:

```auto
{'to': Eval('email', '')}.

```

This works as expected.  
But I have another case where the form\_print keyword is attached to a wizard action that prints a report at the end state. If I don’t define “email” data on report it opens the email with attachment (and no info of recipient, of course). Defining “email” data on report the tryton client gives the error:

```auto
ERROR:tryton.common.common: File "/home/smorillo/code/tryton/tryton/common/common.py", line 1157, in process
    self.callback(return_)
  File "/home/smorillo/code/tryton/tryton/gui/window/wizard.py", line 155, in end_callback
    callback()
  File "/home/smorillo/code/tryton/tryton/gui/window/wizard.py", line 139, in <lambda>
    self.end(lambda *a: execute_actions())
  File "/home/smorillo/code/tryton/tryton/gui/window/wizard.py", line 136, in execute_actions
    Action._exec_action(*action, context=context)
  File "/home/smorillo/code/tryton/tryton/action/main.py", line 174, in _exec_action
    email=action.get('email'), context=context)
  File "/home/smorillo/code/tryton/tryton/action/main.py", line 45, in exec_report
    mailto(to=email.get('to'), cc=email.get('cc'),

'str' object has no attribute 'get'

```

Debugging tryton client I notice action dictionary does not have “pyson\_email” key, so it cannot eval email string and convert it to dictionary.  
How to add this key from wizard? Is it supported?

PD: I’m working on 5.0

---

<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:** [November 18, 2019, 6:09pm UTC](https://discuss.tryton.org/t/error-when-email-print-from-a-form-print-keyword-with-wizard/1972/2 "2019-11-18T18:09:36Z")

</div>

The wizard client-side does not expect that the action returned by a wizard server-side should be evaluated against pyson\_email. This is because wizard are running code that can set directly the values (and there are no real record to use for evaluation).  
So you must fill the `email` key of the action with the proper dictionary (with static value, no PYSON) in the `do_<action>` of the wizard.

---

<div class="post-metadata">

**Author:** ![sergyo](https://discuss-cdn.tryton.org/user_avatar/discuss.tryton.org/sergyo/32/181_2.png) [@sergyo](https://discuss.tryton.org/u/sergyo)\
**Post date:** [November 18, 2019, 9:17pm UTC](https://discuss.tryton.org/t/error-when-email-print-from-a-form-print-keyword-with-wizard/1972/3 "2019-11-18T21:17:02Z")

</div>

> [@ced](#):
>
> So you must fill the `email` key of the action with the proper dictionary (with static value, no PYSON) in the `do_<action>` of the wizard.

It works! Thanks a lot.

---

<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:** [December 18, 2019, 9:17pm UTC](https://discuss.tryton.org/t/error-when-email-print-from-a-form-print-keyword-with-wizard/1972/4 "2019-12-18T21:17:07Z")

</div>

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