From 41b24808939c3f48d0edffc53ed5f26fcd488718 Mon Sep 17 00:00:00 2001 From: "Thomas Lefebvre (thle)" Date: Wed, 29 Mar 2023 06:17:54 +0000 Subject: [PATCH] [FIX] hr_holidays: add employee in the event title of the calendar view Issue: In the calendar view of Time Off (Approvals / Time Off), we see the "display_name" of the events, but we don't see explicitly the name of the employees associated with the events. Solution: Change the title of the event by adding the employee's name at the beginning. opw-3239972 closes odoo/odoo#117376 X-original-commit: 508f2a9a0adac804f82c24512d85458a888d7b62 Signed-off-by: Kevin Baptiste Signed-off-by: Lefebvre Thomas (thle) --- .../static/src/views/calendar/calendar_model.js | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/addons/hr_holidays/static/src/views/calendar/calendar_model.js b/addons/hr_holidays/static/src/views/calendar/calendar_model.js index 036fd7c0086..fdc8d84ba20 100644 --- a/addons/hr_holidays/static/src/views/calendar/calendar_model.js +++ b/addons/hr_holidays/static/src/views/calendar/calendar_model.js @@ -13,6 +13,18 @@ export class TimeOffCalendarModel extends CalendarModel { } } + /** + * @override + */ + normalizeRecord(rawRecord) { + let result = super.normalizeRecord(...arguments); + if (rawRecord.employee_id) { + const employee = rawRecord.employee_id[1]; + result.title = [employee, result.title].join(' '); + } + return result; + } + makeContextDefaults(record) { const { scale } = this.meta; const context = super.makeContextDefaults(record);