From 0b25547fc691d66d3b78fb544f5fda52bb5cbe28 Mon Sep 17 00:00:00 2001 From: Kevin Baptiste Date: Thu, 8 Aug 2019 06:43:24 +0000 Subject: [PATCH] [IMP] hr_holidays: add domain on active time off Add a domain to only count active holiday allocations on the employee's profile. TaskID: 2048672 closes odoo/odoo#35547 Signed-off-by: Yannick Tivisse (yti) --- addons/hr_holidays/models/hr.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/addons/hr_holidays/models/hr.py b/addons/hr_holidays/models/hr.py index be5294d847a..68e20bb3420 100644 --- a/addons/hr_holidays/models/hr.py +++ b/addons/hr_holidays/models/hr.py @@ -116,7 +116,7 @@ class Employee(models.Model): ) h join hr_leave_type s ON (s.id=h.holiday_status_id) WHERE - h.state='validate' AND + s.active = true AND h.state='validate' AND (s.allocation_type='fixed' OR s.allocation_type='fixed_allocation') AND h.employee_id in %s GROUP BY h.employee_id""", (tuple(self.ids),)) @@ -135,6 +135,7 @@ class Employee(models.Model): for employee in self: allocations = self.env['hr.leave.allocation'].search([ ('employee_id', '=', employee.id), + ('holiday_status_id.active', '=', True), ('state', '=', 'validate'), '|', ('date_to', '=', False),