diff --git a/addons/mail/static/src/views/web/activity/activity_record.js b/addons/mail/static/src/views/web/activity/activity_record.js index 80b9d8135ce..28e1d65c3ad 100644 --- a/addons/mail/static/src/views/web/activity/activity_record.js +++ b/addons/mail/static/src/views/web/activity/activity_record.js @@ -4,6 +4,7 @@ import { ActivityCompiler } from "@mail/views/web/activity/activity_compiler"; import { Component } from "@odoo/owl"; +import { evaluateBooleanExpr } from "@web/core/py_js/py"; import { useService } from "@web/core/utils/hooks"; import { Field } from "@web/views/fields/field"; import { @@ -25,6 +26,7 @@ export class ActivityRecord extends Component { static template = "mail.ActivityRecord"; setup() { + this.evaluateBooleanExpr = evaluateBooleanExpr; this.user = useService("user"); this.widget = { deletable: false, diff --git a/addons/test_mail/static/tests/activity_tests.js b/addons/test_mail/static/tests/activity_tests.js index f6ee2e14fa2..c055ab792a8 100644 --- a/addons/test_mail/static/tests/activity_tests.js +++ b/addons/test_mail/static/tests/activity_tests.js @@ -77,6 +77,18 @@ QUnit.module("test_mail", {}, function () { "" + "" + "", + "mail.test.activity,1,activity": ` + +
+ + + + + Test invisible + +
+
+ `, }, }; }, @@ -1033,4 +1045,38 @@ QUnit.module("test_mail", {}, function () { "image src is the preview image given in option" ); }); + + QUnit.test("test node is visible with invisible attribute on node", async function (assert) { + const { target, openView } = await start({ + serverData, + }); + await openView({ + res_model: "mail.test.activity", + views: [[1, "activity"]], + }); + + assert.containsN( + target, + ".invisible_node", + 2, + "The node with the invisible attribute should be displayed since the context does not have `invisible` key or has falsy value" + ); + }); + + QUnit.test("test node is not displayed with invisible attribute on node", async function (assert) { + const { target, openView } = await start({ + serverData, + }); + await openView({ + res_model: "mail.test.activity", + views: [[1, "activity"]], + context: { invisible: true }, + }); + + assert.containsNone( + target, + ".invisible_node", + "The node with the invisible attribute should be displayed since `invisible` key in the context contains truly value" + ); + }); });