[FIX] website_project{_issue}: redirect from email
- Create a portal user - Set an email address - Create a project with tasks / issues - Create a task / issue, set the portal user as follower => he should have access to the task from URL `/my/task/<id>`. - On an email received (e.g. when the user is set as follower), click on 'View Task' The user is redirected to the chatter instead of `/my/task/<id>` or `/my/issue/<id>`. In method, `_redirect_to_record`, the record is browsed as `sudo`. Therefore, in `get_access_action`, `self.env.user` is the admin. We check the context to get the original user. opw-1814577
This commit is contained in:
committed by
Nicolas Martinelli
parent
da1f153d61
commit
4c692f1bb3
@@ -11,7 +11,11 @@ class Project(models.Model):
|
||||
""" Instead of the classic form view, redirect to website for portal users
|
||||
that can read the project. """
|
||||
self.ensure_one()
|
||||
if self.env.user.share:
|
||||
if self.env.context.get('uid'):
|
||||
user = self.env['res.users'].browse(self.env.context['uid'])
|
||||
else:
|
||||
user = self.env.user
|
||||
if user.share:
|
||||
try:
|
||||
self.check_access_rule('read')
|
||||
except exceptions.AccessError:
|
||||
@@ -43,7 +47,11 @@ class Task(models.Model):
|
||||
""" Instead of the classic form view, redirect to website for portal users
|
||||
that can read the task. """
|
||||
self.ensure_one()
|
||||
if self.env.user.share:
|
||||
if self.env.context.get('uid'):
|
||||
user = self.env['res.users'].browse(self.env.context['uid'])
|
||||
else:
|
||||
user = self.env.user
|
||||
if user.share:
|
||||
try:
|
||||
self.check_access_rule('read')
|
||||
except exceptions.AccessError:
|
||||
|
||||
@@ -13,7 +13,11 @@ class Issue(models.Model):
|
||||
""" Instead of the classic form view, redirect to website for portal users
|
||||
that can read the issue. """
|
||||
self.ensure_one()
|
||||
if self.env.user.share:
|
||||
if self.env.context.get('uid'):
|
||||
user = self.env['res.users'].browse(self.env.context['uid'])
|
||||
else:
|
||||
user = self.env.user
|
||||
if user.share:
|
||||
try:
|
||||
self.check_access_rule('read')
|
||||
except exceptions.AccessError:
|
||||
|
||||
Reference in New Issue
Block a user