[FIX] website_forum: Use sudo to send new question notification

Otherwise portal users can not access to some partners subscribed to the forum.
Closes #9855
This commit is contained in:
eLBati
2015-12-03 11:58:54 +01:00
committed by Martin Trigaux
parent 1441f0f25d
commit 44ad6f37b1
+1 -1
View File
@@ -492,7 +492,7 @@ class Post(models.Model):
elif post.state == 'pending' and not post.parent_id:
# TDE FIXME: in master, you should probably use a subtype;
# however here we remove subtype but set partner_ids
partners = post.message_partner_ids.filtered(lambda partner: partner.user_ids and partner.user_ids.karma >= post.forum_id.karma_moderate)
partners = post.sudo().message_partner_ids.filtered(lambda partner: partner.user_ids and partner.user_ids.karma >= post.forum_id.karma_moderate)
note_subtype = self.sudo().env.ref('mail.mt_note')
body = _(
'<p>A new question <i>%s</i> has been asked on %s and require your validation. <a href="%s/forum/%s/question/%s">Click here to access the question.</a></p>' %