From 5fef9d27d05027d3e1d9598cf51a0f7d23d74251 Mon Sep 17 00:00:00 2001 From: Swapnesh Shah Date: Sun, 27 Oct 2019 09:48:49 +0000 Subject: [PATCH] [FIX] hr_org_chart: Compute non-stored fields in superuser mode closes odoo/odoo#39428 X-original-commit: 1f2ff1e93b6fcbf2d6a2153465aa81852cc65816 Signed-off-by: Nicolas Martinelli (nim) --- addons/hr_org_chart/models/hr_employee.py | 6 ++++-- addons/hr_org_chart/models/hr_org_chart_mixin.py | 3 ++- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/addons/hr_org_chart/models/hr_employee.py b/addons/hr_org_chart/models/hr_employee.py index 8d04dd989ec..e3d7c8bb4b1 100644 --- a/addons/hr_org_chart/models/hr_employee.py +++ b/addons/hr_org_chart/models/hr_employee.py @@ -7,10 +7,12 @@ from odoo import fields, models class Employee(models.Model): _inherit = ["hr.employee"] - subordinate_ids = fields.One2many('hr.employee', string='Subordinates', compute='_compute_subordinates', help="Direct and indirect subordinates") + subordinate_ids = fields.One2many('hr.employee', string='Subordinates', compute='_compute_subordinates', help="Direct and indirect subordinates", + compute_sudo=True) class HrEmployeePublic(models.Model): _inherit = ["hr.employee.public"] - subordinate_ids = fields.One2many('hr.employee.public', string='Subordinates', compute='_compute_subordinates', help="Direct and indirect subordinates") + subordinate_ids = fields.One2many('hr.employee.public', string='Subordinates', compute='_compute_subordinates', help="Direct and indirect subordinates", + compute_sudo=True) diff --git a/addons/hr_org_chart/models/hr_org_chart_mixin.py b/addons/hr_org_chart/models/hr_org_chart_mixin.py index 7633f2325ab..e687c51feb0 100644 --- a/addons/hr_org_chart/models/hr_org_chart_mixin.py +++ b/addons/hr_org_chart/models/hr_org_chart_mixin.py @@ -9,7 +9,8 @@ class HrEmployeeBase(models.AbstractModel): child_all_count = fields.Integer( 'Indirect Surbordinates Count', - compute='_compute_subordinates', store=False) + compute='_compute_subordinates', store=False, + compute_sudo=True) def _get_subordinates(self, parents=None): """