[FIX] web: fix project calendar display name

This commit removes the displayName variable of the calendar controller
since it wasn't used anymore and the extension of the displayName is now
updated in the ProjectCalendarController instead. This fixes an issue in
project where the extension of the displayName in the project calendar
controller ( - Tasks by Deadline) would not be shown in the view.

opw-3410987

closes odoo/odoo#128461

X-original-commit: 120ab2513b487d0c117e5c67ed76e6d154d0243f
Signed-off-by: Mathieu Duckerts-Antoine (dam) <dam@odoo.com>
This commit is contained in:
Julien Carion (juca)
2023-07-15 10:54:31 +02:00
parent 12ffafaae0
commit 75481e2db0
3 changed files with 54 additions and 3 deletions
@@ -10,6 +10,6 @@ export class ProjectCalendarController extends CalendarController {
};
setup() {
super.setup(...arguments);
this.displayName += this.env._t(" - Tasks by Deadline");
this.env.config.setDisplayName(this.env.config.getDisplayName() + this.env._t(" - Tasks by Deadline"));
}
}
@@ -0,0 +1,53 @@
/** @odoo-module **/
import { createWebClient, doAction } from "@web/../tests/webclient/helpers";
let serverData;
QUnit.module("Project Task Calendar View", (hooks) => {
hooks.beforeEach(() => {
serverData = {
models: {
"project.task": {
fields: {
start: { string: "Date Start", type: "date" },
stop: { string: "Date End", type: "date" },
},
records: [
{
id: 1,
start: "2017-01-25",
stop: "2017-01-26",
}, {
id: 2,
start: "2017-01-02",
stop: "2017-01-03",
},
],
methods: {
check_access_rights: function () {
return Promise.resolve(true);
}
}
},
},
}
});
QUnit.test("breadcrumb contains 'Tasks by deadline'", async function (assert) {
serverData.views = {
"project.task,1,calendar": `<calendar date_start="start" date_stop="stop" mode="day" js_class="project_calendar"/>`,
"project.task,false,search": `<search />`,
};
serverData.actions = {
1: {
id: 1,
name: "test",
res_model: "project.task",
type: "ir.actions.act_window",
views: [[1, "calendar"]],
context: {},
},
};
const webClient = await createWebClient({ serverData });
await doAction(webClient, 1);
assert.equal(document.querySelector(".o_last_breadcrumb_item span").textContent, 'test - Tasks by Deadline');
});
});
@@ -51,7 +51,6 @@ export class CalendarController extends Component {
}, {
onWillStart: this.onWillStartModel.bind(this),
});
this.displayName = this.env.config.getDisplayName();
useSetupView({
getLocalState: () => this.model.exportedState,
@@ -71,7 +70,6 @@ export class CalendarController extends Component {
deleteRecord: this.deleteRecord.bind(this),
editRecord: this.editRecord.bind(this),
setDate: this.setDate.bind(this),
displayName: this.displayName,
};
}
get containerProps() {