From e602a5550398ac0696a2e4fb6d48c410eafae267 Mon Sep 17 00:00:00 2001 From: fdardenne <dafl@odoo.com> Date: Fri, 6 Jan 2023 10:26:46 +0000 Subject: [PATCH] [FIX] mail: activity view: luxon in rendering context Since the refactoring of the activity view, luxon is not in the rendering context. Resulting in crashing in some activity views that used luxon in their template. - Go to Appraisal - Switch to the activity view - Create a record in this view -> crash Now, luxon is in the rendering context. closes odoo/odoo#109153 Signed-off-by: Luca Vitali <luvi@odoo.com> --- .../src/views/activity/activity_record.js | 1 + .../test_mail/static/tests/activity_tests.js | 23 +++++++++++++++++++ 2 files changed, 24 insertions(+) diff --git a/addons/mail/static/src/views/activity/activity_record.js b/addons/mail/static/src/views/activity/activity_record.js index 3faf1ddfe84e..2789ee0c416e 100644 --- a/addons/mail/static/src/views/activity/activity_record.js +++ b/addons/mail/static/src/views/activity/activity_record.js @@ -44,6 +44,7 @@ export class ActivityRecord extends Component { activity_image: (...args) => getImageSrcFromRecordInfo(record, ...args), user_context: this.user.context, widget: this.widget, + luxon, }; } } diff --git a/addons/test_mail/static/tests/activity_tests.js b/addons/test_mail/static/tests/activity_tests.js index 6e5babf2a780..af7f07571b07 100644 --- a/addons/test_mail/static/tests/activity_tests.js +++ b/addons/test_mail/static/tests/activity_tests.js @@ -842,4 +842,27 @@ QUnit.module("test_mail", {}, function () { ); } }); + + QUnit.test("Activity view: luxon in renderingContext", async function (assert) { + Object.assign(serverData.views, { + "mail.test.activity,false,activity": ` + <activity string="MailTestActivity"> + <templates> + <div t-name="activity-box"> + <t t-if="luxon"> + <span class="luxon">luxon</span> + </t> + </div> + </templates> + </activity>`, + }); + const { openView } = await start({ + serverData, + }); + await openView({ + res_model: "mail.test.activity", + views: [[false, "activity"]], + }); + assert.containsN(document.body, ".luxon", 2); + }); }); -- GitLab