[FIX] hr_holidays: redirect to allocation record in report

Steps to reproduce:
-------------------
- go to time-off analysis (by type);
- group by "Requet Type" and use list view;
- click on an allocation;

Issue:
------
We don't have the record for this allocation.

Cause:
------
Commit [^1] removes the `allocation_id` field, so it is no
longer possible to retrieve a record from the
`hr.leave.allocation` model.

Solution:
---------
Place the allocation id in the `leave_id` field and use the
`leave_type` field to determine the model
(`hr.leave` or `hr.leave.allocation`).

opw-3748884

[^1]: a1949ca541

closes odoo/odoo#157204

Signed-off-by: Sofie Gvaladze (sgv) <sgv@odoo.com>
This commit is contained in:
Thomas Lefebvre (thle)
2024-03-11 16:37:36 +00:00
parent 5f11a12fd4
commit 55c77ae7d9
+2 -2
View File
@@ -52,7 +52,7 @@ class LeaveReport(models.Model):
leaves.holiday_type as holiday_type, leaves.date_from as date_from,
leaves.date_to as date_to, leaves.company_id
from (select
null as leave_id,
allocation.id as leave_id,
allocation.employee_id as employee_id,
allocation.private_name as name,
allocation.number_of_days as number_of_days,
@@ -97,5 +97,5 @@ class LeaveReport(models.Model):
'type': 'ir.actions.act_window',
'view_mode': 'form',
'res_id': self.leave_id.id,
'res_model': 'hr.leave',
'res_model': 'hr.leave' if self.leave_type == 'request' else 'hr.leave.allocation',
}