mirror of https://github.com/OCA/social.git
[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.pull/1072/head
parent
00aa465fba
commit
daee70150f
|
@ -27,11 +27,16 @@ class MailTemplate(models.Model):
|
||||||
if this.body_type == 'qweb' and\
|
if this.body_type == 'qweb' and\
|
||||||
(not fields or 'body_html' in fields):
|
(not fields or 'body_html' in fields):
|
||||||
for record in self.env[this.model].browse(record_id):
|
for record in self.env[this.model].browse(record_id):
|
||||||
|
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 not isinstance(body_html, unicode):
|
||||||
|
body_html = body_html.decode('utf-8')
|
||||||
result[record_id]['body_html'] = self.render_post_process(
|
result[record_id]['body_html'] = self.render_post_process(
|
||||||
this.body_view_id.render({
|
body_html
|
||||||
'object': record,
|
|
||||||
'email_template': this,
|
|
||||||
})
|
|
||||||
)
|
)
|
||||||
result[record_id]['body'] = tools.html_sanitize(
|
result[record_id]['body'] = tools.html_sanitize(
|
||||||
result[record_id]['body_html']
|
result[record_id]['body_html']
|
||||||
|
|
Loading…
Reference in New Issue