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