diff --git a/addons/project/static/src/views/project_calendar/project_calendar_controller.js b/addons/project/static/src/views/project_calendar/project_calendar_controller.js index 24e61059f9c..c43cc6e50b8 100644 --- a/addons/project/static/src/views/project_calendar/project_calendar_controller.js +++ b/addons/project/static/src/views/project_calendar/project_calendar_controller.js @@ -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")); } } diff --git a/addons/project/static/tests/views/project_task_calendar/project_task_calendar_view_tests.js b/addons/project/static/tests/views/project_task_calendar/project_task_calendar_view_tests.js new file mode 100644 index 00000000000..ac86be0313c --- /dev/null +++ b/addons/project/static/tests/views/project_task_calendar/project_task_calendar_view_tests.js @@ -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": ``, + "project.task,false,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'); + }); +}); diff --git a/addons/web/static/src/views/calendar/calendar_controller.js b/addons/web/static/src/views/calendar/calendar_controller.js index 42f9e6ec4f9..d71a9fcebdb 100644 --- a/addons/web/static/src/views/calendar/calendar_controller.js +++ b/addons/web/static/src/views/calendar/calendar_controller.js @@ -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() {