[FIX] website_forum: child_ids from current forum only

Before this commit, we got all post where parent_id = self.id, whatever the forum_id from the post
This commit is contained in:
Jeremy Kersten
2020-06-08 07:43:07 +00:00
parent 1b7f55a15e
commit f553d871fa
+1 -1
View File
@@ -281,7 +281,7 @@ class Post(models.Model):
is_correct = fields.Boolean('Correct', help='Correct answer or answer accepted')
parent_id = fields.Many2one('forum.post', string='Question', ondelete='cascade', readonly=True, index=True)
self_reply = fields.Boolean('Reply to own question', compute='_is_self_reply', store=True)
child_ids = fields.One2many('forum.post', 'parent_id', string='Post Answers')
child_ids = fields.One2many('forum.post', 'parent_id', string='Post Answers', domain=lambda self: [('forum_id', '=', self.forum_id.id)])
child_count = fields.Integer('Answers', compute='_get_child_count', store=True)
uid_has_answered = fields.Boolean('Has Answered', compute='_get_uid_has_answered')
has_validated_answer = fields.Boolean('Is answered', compute='_get_has_validated_answer', store=True)