From 09f821931aa346018abf6c2a76212bb8730d10f7 Mon Sep 17 00:00:00 2001 From: "Pedro M. Baeza" Date: Wed, 19 Oct 2016 08:23:21 +0200 Subject: [PATCH] [FIX] email_template_qweb: The decoding cannot be done after render_post_process call --- email_template_qweb/models/mail_template.py | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) diff --git a/email_template_qweb/models/mail_template.py b/email_template_qweb/models/mail_template.py index 95aaaf58..c38f7fe3 100644 --- a/email_template_qweb/models/mail_template.py +++ b/email_template_qweb/models/mail_template.py @@ -27,18 +27,17 @@ class MailTemplate(models.Model): if this.body_type == 'qweb' and\ (not fields or 'body_html' in fields): for record in self.env[this.model].browse(record_id): - result[record_id]['body_html'] = self.render_post_process( - this.body_view_id.render({ - 'object': record, - 'email_template': this, - }) - ) + body_html = this.body_view_id.render({ + 'object': record, + 'email_template': this, + }) # Some wizards, like when sending a sales order, need this # fix to display accents correctly if isinstance(result[record_id]['body_html'], unicode): - result[record_id]['body_html'] = ( - result[record_id]['body_html'].decode('utf-8') - ) + body_html = body_html.decode('utf-8') + result[record_id]['body_html'] = self.render_post_process( + body_html + ) result[record_id]['body'] = tools.html_sanitize( result[record_id]['body_html'] )