[FIX] hr_holidays: correct domain to compute timeoff and allocation request

Steps to reproduce:
- open kanban view of department from employee module.
- click on 'Allocation Requests' and 'Time Off Requests'.

Issue:
- When viewing the department's allocation and time-off requests in the employee
  module, all department data is displayed, regardless of the department
  selection.

Solution:
- The issue is resolved by correcting the domain, ensuring that only data
  related to the selected department is displayed. This adjustment results in
  accurate department-specific request information.

Task ID-3541358

closes odoo/odoo#145575

X-original-commit: 6bef791f4336725e8ab02b8531bd3507cc9624a5
Signed-off-by: Bertrand Dossogne (bedo) <bedo@odoo.com>
This commit is contained in:
ravb-odoo
2023-12-18 14:34:16 +00:00
parent 0fd4e9e67c
commit cff83453fd
2 changed files with 5 additions and 2 deletions
@@ -5,6 +5,8 @@ import datetime
from dateutil.relativedelta import relativedelta
from odoo import api, fields, models
from odoo.osv import expression
import ast
class Department(models.Model):
@@ -53,6 +55,7 @@ class Department(models.Model):
'search_default_active_employee': 2,
'search_default_department_id': self.id,
'default_department_id': self.id,
'searchpanel_default_department_id': self.id,
}
def action_open_leave_department(self):
@@ -69,4 +72,5 @@ class Department(models.Model):
action = self.env["ir.actions.actions"]._for_xml_id("hr_holidays.hr_leave_allocation_action_approve_department")
action['context'] = self._get_action_context()
action['context']['search_default_second_approval'] = 3
action['domain'] = expression.AND([ast.literal_eval(action['domain']), [('state', '=', 'confirm')]])
return action
+1 -2
View File
@@ -708,8 +708,7 @@
'search_default_waiting_for_me': 1,
'search_default_waiting_for_me_manager': 2,
'hide_employee_name': 1,
'holiday_status_display_name': False}
</field>
'holiday_status_display_name': False}</field>
<field name="domain">['|', ('employee_id.company_id', 'in', allowed_company_ids),
'&amp;', ('multi_employee', '=', True),
'&amp;', ('state', 'in', ['draft', 'confirm', 'validate1']),