From 119eddf7ccbfbf269a9ac4253159dcfc38b6b32b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lucas=20Lef=C3=A8vre?= Date: Thu, 12 Mar 2020 14:02:14 +0000 Subject: [PATCH] [FIX] hr_contract: Allow HR user to read first contract date An HR user (without any rights on contracts) could not open an employee form view since it needs the `first_contract_date` field which needs contracts access rights. closes odoo/odoo#47561 X-original-commit: 14855eee0f9c5737ee5aaa792defe88e138e0d7d Signed-off-by: lul-odoo --- 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 8c4e900f97b..7c293855980 100644 --- a/addons/hr_contract/models/hr_employee.py +++ b/addons/hr_contract/models/hr_employee.py @@ -21,7 +21,7 @@ class Employee(models.Model): @api.depends('contract_ids.state') def _compute_first_contract_date(self): for employee in self: - contracts = employee.contract_ids.filtered(lambda c: c.state != 'cancel') + contracts = employee.sudo().contract_ids.filtered(lambda c: c.state != 'cancel') if contracts: employee.first_contract_date = min(contracts.mapped('date_start')) else: