From 43bc9897e3c737eb4a7faa924bf71e936e2767cf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Alexandre=20K=C3=BChn?= Date: Thu, 30 Mar 2023 14:37:50 +0000 Subject: [PATCH] [FIX] mail: read more/less link on message of type notification MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Read more/less requires content being `t-ref="body". It was not properly set for messages of type notification, thus skipping the read more/less insertion in the content. closes odoo/odoo#117203 Signed-off-by: Alexandre Kühn (aku) --- addons/mail/static/src/web/message_patch.xml | 2 +- .../static/tests/web/form_renderer_tests.js | 42 +++++++++++++++++++ 2 files changed, 43 insertions(+), 1 deletion(-) diff --git a/addons/mail/static/src/web/message_patch.xml b/addons/mail/static/src/web/message_patch.xml index 31631222516..d443b048dbe 100644 --- a/addons/mail/static/src/web/message_patch.xml +++ b/addons/mail/static/src/web/message_patch.xml @@ -20,7 +20,7 @@ -
+
diff --git a/addons/mail/static/tests/web/form_renderer_tests.js b/addons/mail/static/tests/web/form_renderer_tests.js index c6d142b8f47..6c4527e7aba 100644 --- a/addons/mail/static/tests/web/form_renderer_tests.js +++ b/addons/mail/static/tests/web/form_renderer_tests.js @@ -291,3 +291,45 @@ QUnit.test( assert.containsOnce($, ".o-mail-read-more-less:contains(Read Less)"); } ); + +QUnit.test("read more/less links on message of type notification", async (assert) => { + const pyEnv = await startServer(); + const partnerId = pyEnv["res.partner"].create({}); + pyEnv["mail.message"].create({ + author_id: partnerId, + // "data-o-mail-quote" enables read more/less blocks + body: ` +
+ Dear Joel Willis,
+ Thank you for your enquiry.
+ If you have any questions, please let us know. +

+ Thank you,
+ --
+ System +
+
`, + model: "res.partner", + res_id: partnerId, + message_type: "notification", + }); + const views = { + "res.partner,false,form": ` +
+ + + +
+ +
+
`, + }; + const { openView } = await start({ serverData: { views } }); + const openViewAction = { + res_model: "res.partner", + res_id: partnerId, + views: [[false, "form"]], + }; + await openView(openViewAction); + assert.containsOnce($, ".o-mail-Message a:contains(Read More)"); +});