From b8006bfb1c30ee92e8374f135546764d1cae7db2 Mon Sep 17 00:00:00 2001 From: Christophe Matthieu Date: Mon, 7 May 2018 13:52:26 +0200 Subject: [PATCH] [FIX] mail tools: html_sanitize must keep useful styles from mass mailing Issue: The clean removes too many tags so emails sent do not resemble the preview. opw-1841138 opw-1841105 --- odoo/tools/mail.py | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/odoo/tools/mail.py b/odoo/tools/mail.py index 328fa81465c..285808cd0cd 100644 --- a/odoo/tools/mail.py +++ b/odoo/tools/mail.py @@ -42,14 +42,23 @@ class _Cleaner(clean.Cleaner): _style_re = re.compile('''([\w-]+)\s*:\s*((?:[^;"']|"[^"]*"|'[^']*')+)''') _style_whitelist = [ - 'font-size', 'font-family', 'background-color', 'color', 'text-align', + 'font-size', 'font-family', 'font-weight', + 'background-color', 'color', 'float', 'vertical-align', + 'line-height', 'text-align', 'text-decoration', 'padding', 'padding-top', 'padding-left', 'padding-bottom', 'padding-right', - 'margin', 'margin-top', 'margin-left', 'margin-bottom', 'margin-right' + 'margin', 'margin-top', 'margin-left', 'margin-bottom', 'margin-right', # box model - 'border', 'border-color', 'border-radius', 'height', 'margin', 'padding', 'width', 'max-width', 'min-width', + 'border', 'border-color', 'border-style', 'border-radius', 'border-width', + 'height', 'margin', 'padding', 'width', 'max-width', 'min-width', # tables 'border-collapse', 'border-spacing', 'caption-side', 'empty-cells', 'table-layout'] + _style_whitelist.extend( + ['border-%s-%s' % (position, attribute) + for position in ['top', 'bottom', 'left', 'right'] + for attribute in ('style', 'color', 'width', 'left-radius', 'right-radius')] + ) + strip_classes = False sanitize_style = False