From cff83453fd6eed2f7e9ee6d879e20f8d28d27d60 Mon Sep 17 00:00:00 2001 From: ravb-odoo Date: Tue, 17 Oct 2023 07:11:51 +0000 Subject: [PATCH] [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) --- addons/hr_holidays/models/hr_department.py | 4 ++++ addons/hr_holidays/views/hr_leave_views.xml | 3 +-- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/addons/hr_holidays/models/hr_department.py b/addons/hr_holidays/models/hr_department.py index 8893eb4520b..ddc6ef46da4 100644 --- a/addons/hr_holidays/models/hr_department.py +++ b/addons/hr_holidays/models/hr_department.py @@ -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 diff --git a/addons/hr_holidays/views/hr_leave_views.xml b/addons/hr_holidays/views/hr_leave_views.xml index 499485d75a7..33815e954c1 100644 --- a/addons/hr_holidays/views/hr_leave_views.xml +++ b/addons/hr_holidays/views/hr_leave_views.xml @@ -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} - + 'holiday_status_display_name': False} ['|', ('employee_id.company_id', 'in', allowed_company_ids), '&', ('multi_employee', '=', True), '&', ('state', 'in', ['draft', 'confirm', 'validate1']),