From 1e71ba3995de7653175e7add2aa701a02cedea1e Mon Sep 17 00:00:00 2001 From: "Xavier BOL (xbo)" Date: Tue, 7 Sep 2021 08:43:24 +0000 Subject: [PATCH] [FIX] project: access error when internal user is in project sharing form view Before this commit, when the internal user is not follower of the project and enter in the project sharing feature. If he wants to see the form view of a task, he cannot and have a Session expired error. This issue arrives because in the chatter we check is the user is a follower of the project shared. This commit fixes this issue by just using the _document_check_access method to check if the user can access to the document. Indeed, we don't need to check if user is a follower because the _document_check_access does it with the `ir.rules`. Related PR: #73341 Part of task-2633229 closes #76098 --- addons/project/controllers/project_sharing_chatter.py | 5 ----- 1 file changed, 5 deletions(-) diff --git a/addons/project/controllers/project_sharing_chatter.py b/addons/project/controllers/project_sharing_chatter.py index c3e3bc2b9c2..b7552557791 100644 --- a/addons/project/controllers/project_sharing_chatter.py +++ b/addons/project/controllers/project_sharing_chatter.py @@ -4,7 +4,6 @@ from werkzeug.exceptions import Forbidden from odoo.http import request, route -from odoo.tools import consteq from odoo.addons.portal.controllers.mail import PortalChatter from .portal import ProjectCustomerPortal @@ -24,10 +23,6 @@ class ProjectSharingChatter(PortalChatter): """ project_sudo = ProjectCustomerPortal._document_check_access(self, 'project.project', project_id, token) can_access = project_sudo and res_model == 'project.task' and project_sudo.with_user(request.env.user)._check_project_sharing_access() - if token: - can_access &= consteq(project_sudo.access_token, token) - else: - can_access &= request.env.user.partner_id.commercial_partner_id in project_sudo.message_partner_ids task = None if can_access: task = request.env['project.task'].sudo().search([('id', '=', res_id), ('project_id', '=', project_sudo.id)])