Error when email_print from a "form_print" keyword with wizard

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:
{'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:

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

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.

It works! Thanks a lot.

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