[FIX] mass_mailing: preserve comments when testing a mailing

When sending a mailing we make sure to preserve comments (in particular
so that MSO comments can be read by Outlook). However this was not the
case when testing a mailing using the Test button in the form view.

task-3488162
opw-3290548
opw-3479234

closes odoo/odoo#133998

X-original-commit: 66b1dc38ced221d63f11827a217f9805827d5e65
Signed-off-by: Antoine Guenet (age) <age@odoo.com>
Signed-off-by: David Monjoie (dmo) <dmo@odoo.com>
This commit is contained in:
Antoine Guenet
2023-09-01 16:46:06 +00:00
parent edb9914018
commit cf61c63ddf
@@ -39,7 +39,7 @@ class TestMassMailing(models.TransientModel):
if record:
# Returns a proper error if there is a syntax error with Qweb
# do not force lang, will simply use user context
body = mailing._render_field('body_html', record.ids, compute_lang=False)[record.id]
body = mailing._render_field('body_html', record.ids, compute_lang=False, options={'preserve_comments': True})[record.id]
preview = mailing._render_field('preview', record.ids, compute_lang=False)[record.id]
full_body = mailing._prepend_preview(Markup(body), preview)
subject = mailing._render_field('subject', record.ids, compute_lang=False)[record.id]