From 72e33158896b244966db77f63b358b7de969b450 Mon Sep 17 00:00:00 2001 From: Cyril VINH-TUNG Date: Tue, 21 Jul 2026 20:10:00 -1000 Subject: [PATCH] [IMP] hr_shift: use employee name instead of weekday in line display_name hr.shift.planning.line._compute_display_name currently produces '{weekday} - {template or state}'. That format is redundant in every place the display_name is actually shown to end users: - On the calendar view, the weekday is the column position, so writing it inside the block label just repeats what the grid already conveys. - On the list and form views, day_number is a dedicated field already rendered as its own column or field, so the weekday appears twice on the same row. Meanwhile the field the display_name lacks is the employee, which makes the identity of a line indistinguishable from another line of the same planning on the same weekday (two employees sharing 'Wednesday - Morning' get the exact same display_name, so any breadcrumb, popover title, chatter mention or mail template that relies on display_name cannot tell them apart). Replace the weekday by the employee's name in the format expression and update @api.depends accordingly. day_number remains fully available through its own field wherever it is needed (calendar column, list column, form field). The employee full name is used as-is, without truncation, consistent with how it appears in every other HR view. --- hr_shift/models/shift_planning.py | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/hr_shift/models/shift_planning.py b/hr_shift/models/shift_planning.py index c0cbdc5..69ef19b 100644 --- a/hr_shift/models/shift_planning.py +++ b/hr_shift/models/shift_planning.py @@ -403,16 +403,18 @@ def _compute_template_id(self): def _group_expand_template_id(self, templates, domain): return self.env["hr.shift.template"].search([]) - @api.depends("day_number", "template_id", "state") + @api.depends("employee_id", "template_id", "state") def _compute_display_name(self): for line in self: line.display_name = ( - f"{_(dict(WEEK_DAYS_SELECTION).get(line.day_number))} - " + f"{line.employee_id.name or ''} - " f""" - {line.template_id.name - or dict( - self._fields['state']._description_selection(self.env) - )[line.state]}""" + { + line.template_id.name + or dict(self._fields["state"]._description_selection(self.env))[ + line.state + ] + }""" ) @api.depends("planning_id", "day_number", "template_id")