From 8293ae5d3778f698de7af7e728e7bd9518bf1d98 Mon Sep 17 00:00:00 2001 From: "Abdelouahab (abla)" Date: Wed, 23 Mar 2022 09:43:22 +0000 Subject: [PATCH] [FIX] hr_holidays : ignore inactive leaves for IM status To reproduce ============ - In a belgian company, set legal time type as no need approval - as admin, take a day in the future with this time off - in the time off form, a cancel appears (near refuse) - Cancel the time off The day of the time off, the flight icon is set on the employee Purpose ======= When cancelling a time off, we set it's `active` field to False, but its state remains `validate`, but when fetching for users on leave, there is no check on the `active` field. Specification ============= To solve the issue a check on `active` field was added to the query. opw-2784173 closes odoo/odoo#87183 X-original-commit: 5d80d7c91fe05716602e2182515a4e26ea957e41 Signed-off-by: Kevin Baptiste --- addons/hr_holidays/models/res_users.py | 1 + 1 file changed, 1 insertion(+) diff --git a/addons/hr_holidays/models/res_users.py b/addons/hr_holidays/models/res_users.py index 112acf17dbd..e89e7addc56 100644 --- a/addons/hr_holidays/models/res_users.py +++ b/addons/hr_holidays/models/res_users.py @@ -50,6 +50,7 @@ class User(models.Model): self.env.cr.execute('''SELECT res_users.%s FROM res_users JOIN hr_leave ON hr_leave.user_id = res_users.id AND state not in ('cancel', 'refuse') + AND hr_leave.active = 't' AND res_users.active = 't' AND date_from <= %%s AND date_to >= %%s''' % field, (now, now)) return [r[0] for r in self.env.cr.fetchall()]