From 0cc394f480d887f15f8dcc051f7cc39bdf8d415e Mon Sep 17 00:00:00 2001 From: pedrambiria Date: Thu, 2 Feb 2023 12:55:00 +0000 Subject: [PATCH] [REV] hr_contract: remove group on `contract_id` field https://github.com/odoo/odoo/commit/fa1b4f14257ca04c85c7541fd94b19dff939626c caused an issue when a user doesn't have the `hr.group_hr_user` and has the `hr_contract.group_hr_contract_employee_manager` group. A user who doesn't have `hr.group_hr_user` can not have access to the `hr.employee`, but has access to `hr.employee.public`. The problem is that `hr.employee.public` doesn't have the `contract_id` field. opw-3148092 closes odoo/odoo#111752 X-original-commit: fa6fea0ddce67ae9a3a4244b91c2f1ea79cf3d6d Signed-off-by: Kevin Baptiste --- 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 1d7cc3a9a1b..298fa1a76f8 100644 --- a/addons/hr_contract/models/hr_employee.py +++ b/addons/hr_contract/models/hr_employee.py @@ -12,7 +12,7 @@ class Employee(models.Model): vehicle = fields.Char(string='Company Vehicle', groups="hr.group_hr_user") contract_ids = fields.One2many('hr.contract', 'employee_id', string='Employee Contracts') contract_id = fields.Many2one( - 'hr.contract', string='Current Contract', groups="hr.group_hr_user,hr_contract.group_hr_contract_employee_manager", + 'hr.contract', string='Current Contract', groups="hr.group_hr_user", domain="[('company_id', '=', company_id), ('employee_id', '=', id)]", help='Current contract of the employee') calendar_mismatch = fields.Boolean(related='contract_id.calendar_mismatch') contracts_count = fields.Integer(compute='_compute_contracts_count', string='Contract Count')