[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 <kba@odoo.com>
This commit is contained in:
Abdelouahab (abla)
2022-03-24 17:12:34 +01:00
parent 7d0e3cd7e3
commit 8293ae5d37
+1
View File
@@ -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()]