[FIX] mail: fix activity view domain on reload
Steps: - Install project app. - Go to task view from specific project. - Open activity view. - Set an activity on any task. - Click on "Schedule Activity" button. Issue: - User able to select all tasks instead of tasks from that specific project as it is working for first time user opens that view. Cause: - Domain of `SelectCreateDialog` became empty when load calls from other activity view actions. Fix: - Pass props in load method call to have default data as it is when calling load method. task-3293310 closes odoo/odoo#143721 X-original-commit: fd96a43af96ef6706680a97d19a184c6e4aad6fb Signed-off-by: Francois Georis (fge) <fge@odoo.com> Signed-off-by: Kartik Chavda (kcv) <kcv@odoo.com>
This commit is contained in:
@@ -64,7 +64,7 @@ export class ActivityController extends Component {
|
||||
context: this.props.context,
|
||||
onSelected: async (resIds) => {
|
||||
await this.activity.schedule(this.props.resModel, resIds);
|
||||
this.model.load();
|
||||
this.model.load(this.props);
|
||||
},
|
||||
});
|
||||
}
|
||||
@@ -86,7 +86,7 @@ export class ActivityController extends Component {
|
||||
},
|
||||
},
|
||||
{
|
||||
onClose: () => this.model.load(),
|
||||
onClose: () => this.model.load(this.props),
|
||||
}
|
||||
);
|
||||
}
|
||||
@@ -119,7 +119,7 @@ export class ActivityController extends Component {
|
||||
archInfo: this.props.archInfo,
|
||||
groupedActivities: this.model.activityData.grouped_activities,
|
||||
scheduleActivity: this.scheduleActivity.bind(this),
|
||||
onReloadData: () => this.model.load(),
|
||||
onReloadData: () => this.model.load(this.props),
|
||||
onEmptyCell: this.openActivityFormView.bind(this),
|
||||
onSendMailTemplate: this.sendMailTemplate.bind(this),
|
||||
openRecord: this.openRecord.bind(this),
|
||||
|
||||
@@ -9,7 +9,7 @@ export class ActivityModel extends RelationalModel {
|
||||
this.originalDomain = params.domain ? [...params.domain] : [];
|
||||
// Ensure that only (active) records with at least one activity, "done" (archived) or not, are fetched.
|
||||
// We don't use active_test=false in the context because otherwise we would also get archived records.
|
||||
params.domain?.push(["activity_ids.active", "in", [true, false]]);
|
||||
params.domain = [...params.domain, ["activity_ids.active", "in", [true, false]]];
|
||||
if (params && "groupBy" in params) {
|
||||
params.groupBy = [];
|
||||
}
|
||||
|
||||
@@ -882,6 +882,41 @@ QUnit.module("test_mail", {}, function () {
|
||||
}
|
||||
);
|
||||
|
||||
QUnit.test("activity view: Domain should not reset on load", async function (assert) {
|
||||
Object.assign(serverData.views, {
|
||||
"mail.test.activity,false,list":
|
||||
'<tree string="MailTestActivity"><field name="name"/></tree>',
|
||||
});
|
||||
const { env, openView } = await start({
|
||||
serverData,
|
||||
});
|
||||
await openView({
|
||||
res_model: "mail.test.activity",
|
||||
views: [[false, "activity"]],
|
||||
domain: [['id', '=', 1]],
|
||||
});
|
||||
patchWithCleanup(env.services.action, {
|
||||
doAction(action, options) {
|
||||
assert.step("doAction");
|
||||
options.onClose();
|
||||
},
|
||||
});
|
||||
|
||||
await click(document.querySelector(".o_activity_view .o_record_selector"));
|
||||
// search create dialog
|
||||
await click(document.querySelector(".modal-lg .o_data_row .o_data_cell"));
|
||||
assert.verifySteps(["doAction"]);
|
||||
|
||||
await click(document.querySelector(".o_activity_view .o_record_selector"));
|
||||
// again open search create dialog
|
||||
assert.strictEqual(
|
||||
document.querySelectorAll(".modal-lg .o_data_row").length,
|
||||
1,
|
||||
"Should contains only one record after calling schedule activity which load view again"
|
||||
);
|
||||
}
|
||||
);
|
||||
|
||||
QUnit.test("Activity view: discard an activity creation dialog", async function (assert) {
|
||||
assert.expect(2);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user