Send email wizard start: load data in language when send a record

This commit is contained in:
resteve 2014-01-15 11:21:36 +01:00
parent 50cb922606
commit 0656940147

View file

@ -144,6 +144,13 @@ class GenerateTemplateEmail(Wizard):
template = wizard.template[0]
total = len(active_ids)
#load data in language when send a record
if template.language and total == 1:
record = Pool().get(template.model.model)(active_ids[0])
language = Template.eval(template, template.language, record)
with Transaction().set_context(language = language):
template = Template(template.id)
default['from_'] = template.from_
default['total'] = total
default['template'] = template.id