[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>
This commit is contained in:
fdardenne
2023-01-10 10:16:51 +01:00
parent ca80a60199
commit e602a55503
2 changed files with 24 additions and 0 deletions
@@ -44,6 +44,7 @@ export class ActivityRecord extends Component {
activity_image: (...args) => getImageSrcFromRecordInfo(record, ...args),
user_context: this.user.context,
widget: this.widget,
luxon,
};
}
}
@@ -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);
});
});