[IMP] hr_holidays: show all employees in list view

A time off for multiple employees was not showing who the employees were
in the list view.

Now it shows the avatar of all employees in the list view.

closes odoo/odoo#78758

Taskid: 2674062
Signed-off-by: Kevin Baptiste <kba@odoo.com>
This commit is contained in:
Kevin Baptiste
2021-10-26 11:04:49 +00:00
parent 28fe74e051
commit 1e99b471f7
2 changed files with 8 additions and 1 deletions
+6
View File
@@ -206,6 +206,7 @@ class HolidaysRequest(models.Model):
inverse='_inverse_supported_attachment_ids')
supported_attachment_ids_count = fields.Integer(compute='_compute_supported_attachment_ids')
# UX fields
all_employee_ids = fields.Many2many('hr.employee', compute='_compute_all_employees')
leave_type_request_unit = fields.Selection(related='holiday_status_id.request_unit', readonly=True)
leave_type_support_document = fields.Boolean(related="holiday_status_id.support_document")
# Interface fields used when not using hour-based computation
@@ -291,6 +292,11 @@ class HolidaysRequest(models.Model):
self._table, ['date_to', 'date_from'])
return res
@api.depends('employee_id', 'employee_ids')
def _compute_all_employees(self):
for leave in self:
leave.all_employee_ids = leave.employee_id | leave.employee_ids
@api.depends_context('uid')
def _compute_description(self):
self.check_access_rights('read')
+2 -1
View File
@@ -469,7 +469,8 @@
<field name="model">hr.leave</field>
<field name="arch" type="xml">
<tree string="Time Off Requests" sample="1">
<field name="employee_id" widget="many2one_avatar_employee" decoration-muted="not active_employee"/>
<field name="employee_id" invisible="1" />
<field name="all_employee_ids" widget="many2many_avatar_employee" decoration-muted="not active_employee" string="Employees" />
<field name="department_id" optional="hidden"/>
<field name="holiday_type" string="Mode" groups="base.group_no_one"/>
<field name="holiday_status_id" class="font-weight-bold"/>