[FIX] mail: activity view: add activity_ids in model domain
Since #107916, the ActivityModel did not include `["activity_ids", "!=", false]` in its domain, causing incoherence in some views and resulting in crashes. To reproduce the issue: - In the runbot, navigate to Website -> eCommerce -> Product. - Switch to the activity view. - Remove the Published filter. - The view crashes due to an incoherence between the data records in the `web_search_read` and the `get_activity_data` calls. This commit resolves the issue by correctly setting the domain. closes odoo/odoo#108807 Signed-off-by: Luca Vitali <luvi@odoo.com>
This commit is contained in:
@@ -41,7 +41,7 @@ export class ActivityController extends Component {
|
||||
this.dialog.add(SelectCreateDialog, {
|
||||
resModel: this.props.resModel,
|
||||
searchViewId: this.env.searchModel.searchViewId,
|
||||
domain: this.props.domain,
|
||||
domain: this.model.originalDomain,
|
||||
title: sprintf(this.env._t("Search: %s"), this.props.archInfo.title),
|
||||
multiSelect: false,
|
||||
context: this.props.context,
|
||||
|
||||
@@ -4,6 +4,8 @@ import { RelationalModel } from "@web/views/relational_model";
|
||||
|
||||
export class ActivityModel extends RelationalModel {
|
||||
async load(params = {}) {
|
||||
this.originalDomain = params.domain ? [...params.domain] : [];
|
||||
params.domain?.push(["activity_ids", "!=", false]);
|
||||
this.activityData = await this.fetchActivityData(params);
|
||||
await super.load(params);
|
||||
}
|
||||
|
||||
@@ -284,6 +284,27 @@ QUnit.module("test_mail", {}, function () {
|
||||
]);
|
||||
});
|
||||
|
||||
QUnit.test("activity view: activity_ids condition in domain", async function (assert) {
|
||||
assert.expect(3);
|
||||
const { openView } = await start({
|
||||
serverData,
|
||||
mockRPC: function (route, args) {
|
||||
if (["get_activity_data", "web_search_read"].includes(args.method)) {
|
||||
assert.step(JSON.stringify(args.kwargs.domain));
|
||||
}
|
||||
},
|
||||
});
|
||||
await openView({
|
||||
res_model: "mail.test.activity",
|
||||
views: [[false, "activity"]],
|
||||
});
|
||||
|
||||
assert.verifySteps([
|
||||
JSON.stringify([["activity_ids", "!=", false]]),
|
||||
JSON.stringify([["activity_ids", "!=", false]]),
|
||||
]);
|
||||
});
|
||||
|
||||
QUnit.test("activity view: activity widget", async function (assert) {
|
||||
assert.expect(16);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user