From 389f794ec5a281b4a38f0c321d43463cea8d1b49 Mon Sep 17 00:00:00 2001 From: tsm-odoo Date: Fri, 30 Jun 2023 07:25:23 +0000 Subject: [PATCH] [FIX] im_livechat: keep line breaks on feedback message MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Before this commit, line breaks where removed from the feedback message at the end of a livechat session. This commit fixes this issue. part of task-3332872 closes odoo/odoo#126925 Signed-off-by: Alexandre Kühn (aku) --- addons/im_livechat/controllers/main.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/addons/im_livechat/controllers/main.py b/addons/im_livechat/controllers/main.py index 53f2282776f..a2974c36ffa 100644 --- a/addons/im_livechat/controllers/main.py +++ b/addons/im_livechat/controllers/main.py @@ -1,6 +1,7 @@ # Part of Odoo. See LICENSE file for full copyright and licensing details. from markupsafe import Markup +import re from werkzeug.exceptions import NotFound from odoo import http, tools, _ @@ -174,7 +175,7 @@ class LivechatController(http.Controller): 'reason': reason, } channel.message_post( - body=body, + body=Markup(re.sub(r'\r\n|\r|\n', '
', body)), message_type='notification', subtype_xmlid='mail.mt_comment' )