From b74dcb975d0dbba87782de771ed3f98fa8884b0e Mon Sep 17 00:00:00 2001 From: Yannick Tivisse Date: Wed, 24 Feb 2021 12:04:38 +0000 Subject: [PATCH] [FIX] hr_contract: Include archived employees on _get_all_contracts Purpose ======= When we want to retrieve all the contract (running for instance), we don't care about the fact that the employee is archived or not. For example when we generate the work entries to generate the payslips, we actually pay the employee, even if he's archived (which is the normal flow). closes odoo/odoo#66836 X-original-commit: 262bf8598f9d885382c05e523543019767b521bf Related: odoo/enterprise#16677 Signed-off-by: Yannick Tivisse (yti) --- addons/hr_contract/models/hr_employee.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addons/hr_contract/models/hr_employee.py b/addons/hr_contract/models/hr_employee.py index a5665853665..a12567387e6 100644 --- a/addons/hr_contract/models/hr_employee.py +++ b/addons/hr_contract/models/hr_employee.py @@ -66,7 +66,7 @@ class Employee(models.Model): """ Returns the contracts of all employees between date_from and date_to """ - return self.search([])._get_contracts(date_from, date_to, states=states) + return self.search(['|', ('active', '=', True), ('active', '=', False)])._get_contracts(date_from, date_to, states=states) def write(self, vals): res = super(Employee, self).write(vals)