diff options
| author | Olivier Dony <odo@openerp.com> | 2014-10-10 19:21:18 +0200 |
|---|---|---|
| committer | Olivier Dony <odo@openerp.com> | 2014-10-10 19:21:18 +0200 |
| commit | edd94b623eaf44f308daddba51e38c08ccd4e7b0 (patch) | |
| tree | 1adb10a3a10040bb27a93753a519ddbb715c762c /addons/mail/mail_thread.py | |
| parent | b13898c05806b4270578fe7234e79deda3a5539d (diff) | |
| parent | 1b49a876196de1f4b6568ff1751f7c7c6b2d5002 (diff) | |
[MERGE] Forward-port 7.0 up to 1b49a87
Diffstat (limited to 'addons/mail/mail_thread.py')
| -rw-r--r-- | addons/mail/mail_thread.py | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/addons/mail/mail_thread.py b/addons/mail/mail_thread.py index 0538ad7b7f8..5d303ecff89 100644 --- a/addons/mail/mail_thread.py +++ b/addons/mail/mail_thread.py @@ -1154,9 +1154,13 @@ class mail_thread(osv.AbstractModel): body = tools.append_content_to_html(u'', body, preserve=True) else: alternative = False + mixed = False + html = u'' for part in message.walk(): if part.get_content_type() == 'multipart/alternative': alternative = True + if part.get_content_type() == 'multipart/mixed': + mixed = True if part.get_content_maintype() == 'multipart': continue # skip container # part.get_filename returns decoded value if able to decode, coded otherwise. @@ -1183,8 +1187,11 @@ class mail_thread(osv.AbstractModel): encoding, errors='replace'), preserve=True) # 3) text/html -> raw elif part.get_content_type() == 'text/html': + # mutlipart/alternative have one text and a html part, keep only the second + # mixed allows several html parts, append html content + append_content = not alternative or (html and mixed) html = tools.ustr(part.get_payload(decode=True), encoding, errors='replace') - if alternative: + if not append_content: body = html else: body = tools.append_content_to_html(body, html, plaintext=False) |
