From ebb6bedab8557f8b2a828b5951e849f70da017c1 Mon Sep 17 00:00:00 2001 From: "Pedro M. Baeza" Date: Mon, 17 Oct 2016 21:01:30 +0200 Subject: [PATCH] [FIX] email_template_qweb: Decode body when encoded If the result is of type unicode, render method encodes it in utf-8. We need to decode it in that case so that the rendering results correct. --- email_template_qweb/models/mail_template.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/email_template_qweb/models/mail_template.py b/email_template_qweb/models/mail_template.py index a8865a70..b05621ba 100644 --- a/email_template_qweb/models/mail_template.py +++ b/email_template_qweb/models/mail_template.py @@ -33,6 +33,10 @@ class MailTemplate(models.Model): 'email_template': this, }) ) + if isinstance(result[record_id]['body_html'], unicode): + result[record_id]['body_html'] = ( + result[record_id]['body_html'].decode('utf-8') + ) result[record_id]['body'] = tools.html_sanitize( result[record_id]['body_html'] )