diff options
| author | Jorge Pinna Puissant <jpp@odoo.com> | 2020-07-31 07:37:53 +0000 |
|---|---|---|
| committer | Jorge Pinna Puissant <jpp@odoo.com> | 2020-08-03 07:51:07 +0000 |
| commit | aaad54bdac42ca1e85f37a2a2acdbf1f3ee522fd (patch) | |
| tree | 659e21a1c0587b13c859cdbb124770e737e34226 /addons/website_forum/models/forum.py | |
| parent | 35b4b6b745a5c3d9df63a4a3e6ff2659126aa0ad (diff) | |
[FIX] website_forum: error when converting answer/comment
- Create 2 companies (A and B for instance);
- Create 2 users with password, one on each company (user 'a' in
company A and user 'b' in company B);
- Add enough karma on both users;
- Add a valid email address to both users;
- As user 'b' :
- open any forum topic and validate the email address;
- post an answer or comment to a forum post;
- As user 'a' :
- open the forum and find the answer/comment made by user 'b';
- convert the answer as comment or convert a comment as answer;
Before this commit, an error was raised : 'Access to unauthorized or
invalid companies'.
opw-2296470
closes odoo/odoo#55301
X-original-commit: ce63a20ca26f1773ea7e1133b0a3796fda692e11
Signed-off-by: Jorge Pinna Puissant (jpp) <jpp@odoo.com>
Diffstat (limited to 'addons/website_forum/models/forum.py')
| -rw-r--r-- | addons/website_forum/models/forum.py | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/addons/website_forum/models/forum.py b/addons/website_forum/models/forum.py index 8ea075febd3..aa1bc38af39 100644 --- a/addons/website_forum/models/forum.py +++ b/addons/website_forum/models/forum.py @@ -780,7 +780,7 @@ class Post(models.Model): 'date': self.create_date, } # done with the author user to have create_uid correctly set - new_message = question.with_user(self_sudo.create_uid.id).with_context(mail_create_nosubscribe=True).message_post(**values) + new_message = question.with_user(self_sudo.create_uid.id).with_context(mail_create_nosubscribe=True).sudo().message_post(**values).sudo(False) # unlink the original answer, using SUPERUSER_ID to avoid karma issues self.sudo().unlink() @@ -824,7 +824,7 @@ class Post(models.Model): 'name': _('Re: %s') % (question.name or ''), } # done with the author user to have create_uid correctly set - new_post = self.with_user(post_create_uid).create(post_values) + new_post = self.with_user(post_create_uid).sudo().create(post_values).sudo(False) # delete comment comment.unlink() |
