From 19549afdfc5082e45f2ceeffe8b98b63d1a4ef72 Mon Sep 17 00:00:00 2001 From: hieu Date: Tue, 19 Jul 2022 01:46:22 +0000 Subject: [PATCH] [FIX] project: fix access error when internal user access to project form Before this commit, when the internal user without any access rights to the Project app and has a link to access to the form view of a "public" project, an access error is occurred when that user when to access to the project form view. The reason is the `project.collaborator` is only accessible to the user with an access right to the Project App and since the number of collaborators displayed in a stat button is computed with the access rights of the current user, the compute cannot be done for the internal user. This commit executes the compute is superuser to prevent the user having access error and to correctly access to the project form view as before. Steps to reproduce the bug: -------------------------- 1) Create a Project P and add *Marc Demo* in the followers of that project if the Privacy Visibility is "Invited internal users". 2) Remove the access rights to the Project app for *Marc Demo* user. 3) Copy the link to the form view of project P. 4) Log in as *Marc Demo*. 5) Paste the link copied in step 3 to access to the form view of project P. Actual Behavior: --------------- An access error is occurred because the user without any access to the Project app cannot access to the `project.collaborator` model. Expected Behavior: ----------------- The internal user without any access rights to the Project App should access to the form view of the project P. closes odoo/odoo#96497 X-original-commit: c725c3fbb29eff49eff3794aff9d407175599e63 Signed-off-by: Xavier --- addons/project/models/project.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addons/project/models/project.py b/addons/project/models/project.py index c514d5b9491..b0d4a9248a4 100644 --- a/addons/project/models/project.py +++ b/addons/project/models/project.py @@ -352,7 +352,7 @@ class Project(models.Model): # Project Sharing fields collaborator_ids = fields.One2many('project.collaborator', 'project_id', string='Collaborators', copy=False) - collaborator_count = fields.Integer('# Collaborators', compute='_compute_collaborator_count') + collaborator_count = fields.Integer('# Collaborators', compute='_compute_collaborator_count', compute_sudo=True) # rating fields rating_request_deadline = fields.Datetime(compute='_compute_rating_request_deadline', store=True)