[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
This commit is contained in:
@@ -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)])
|
||||
|
||||
Reference in New Issue
Block a user