summaryrefslogtreecommitdiff
path: root/addons
diff options
context:
space:
mode:
authorJorge Pinna Puissant <jpp@odoo.com>2020-10-06 08:31:42 +0000
committerJorge Pinna Puissant <jpp@odoo.com>2020-10-09 14:24:16 +0000
commit64e93794efb4193b3dfa7aa43360a1ef274e623d (patch)
tree373ab99283cc6e442007227a6638eb54d67cf190 /addons
parent74780e95a2a3db9d9875aea7e644bf064ecf6b46 (diff)
[FIX] project: access token on task
- Create a new Project with 'Portal user and all employees' as visibility; - Add a portal user as customer; - Create a new task in the Project, without assigning the task to anybody; - Connect to the portal as the portal user; - Send a message on the task. Before this commit, an Error 403 forbidden was raised, this error occurs because the task don't have an access token created, this token will be created when an internal user send a message on the task. Now, the access token is created if the project has a 'Portal user and all employees' visibility, and the portal user can post a message on the task. opw-2345070 closes odoo/odoo#59282 X-original-commit: 8a68fac8b246a3e2435e670d9fb2bfb91cc9f83f Signed-off-by: Jorge Pinna Puissant (jpp) <jpp@odoo.com>
Diffstat (limited to 'addons')
-rw-r--r--addons/project/models/project.py6
1 files changed, 5 insertions, 1 deletions
diff --git a/addons/project/models/project.py b/addons/project/models/project.py
index c59fcab8b97..440b5b64dc2 100644
--- a/addons/project/models/project.py
+++ b/addons/project/models/project.py
@@ -1080,7 +1080,11 @@ class Task(models.Model):
rec_values['next_recurrence_date'] = fields.Datetime.today()
recurrence = self.env['project.task.recurrence'].create(rec_values)
vals['recurrence_id'] = recurrence.id
- return super().create(vals_list)
+ tasks = super().create(vals_list)
+ for task in tasks:
+ if task.project_id.privacy_visibility == 'portal':
+ task._portal_ensure_token()
+ return tasks
def write(self, vals):
now = fields.Datetime.now()