[FIX] mass_mailing: fix preview prepend when sending test email
- Go to Email Marketing and create a new one - Select any template - In Settings tab, set a Preview Text - Send a test The content of the received test email is a text with the html code of the email body. When sending the test email, the body is retrieved with "render_field" method, which does not return a Markup object but a simple string. Then "_prepend_preview" method prepends preview (Markup) to body (str). opw-2686316 closes odoo/odoo#82886 X-original-commit: 71258f5020a0d1c4581cf85df31be3fb3f95562a Signed-off-by: Thibault Delavallee (tde) <tde@openerp.com>
This commit is contained in:
@@ -1,6 +1,8 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
# Part of Odoo. See LICENSE file for full copyright and licensing details.
|
||||
|
||||
from markupsafe import Markup
|
||||
|
||||
from odoo import _, fields, models, tools
|
||||
|
||||
|
||||
@@ -39,7 +41,7 @@ class TestMassMailing(models.TransientModel):
|
||||
# Returns a proper error if there is a syntax error with Qweb
|
||||
body = mailing._render_field('body_html', record.ids, post_process=True)[record.id]
|
||||
preview = mailing._render_field('preview', record.ids, post_process=True)[record.id]
|
||||
full_body = mailing._prepend_preview(body, preview)
|
||||
full_body = mailing._prepend_preview(Markup(body), preview)
|
||||
subject = mailing._render_field('subject', record.ids)[record.id]
|
||||
else:
|
||||
full_body = mailing._prepend_preview(mailing.body_html, mailing.preview)
|
||||
|
||||
Reference in New Issue
Block a user