[FIX] website_forum: fixed setting an answer as valid / invalid. The change

in the behavior of browse records due to the new API introduced a wrong
behavior, now fixed.
This commit is contained in:
Thibault Delavallée 2014-08-26 11:49:08 +02:00
parent 73fc6419a9
commit 10741e2799
1 changed files with 2 additions and 2 deletions

View File

@ -315,9 +315,9 @@ class WebsiteForum(http.Controller):
return {'error': 'anonymous_user'}
# set all answers to False, only one can be accepted
request.registry['forum.post'].write(cr, uid, [c.id for c in post.parent_id.child_ids], {'is_correct': False}, context=context)
request.registry['forum.post'].write(cr, uid, [c.id for c in post.parent_id.child_ids if not c.id == post.id], {'is_correct': False}, context=context)
request.registry['forum.post'].write(cr, uid, [post.id], {'is_correct': not post.is_correct}, context=context)
return not post.is_correct
return post.is_correct
@http.route('/forum/<model("forum.forum"):forum>/post/<model("forum.post"):post>/delete', type='http', auth="user", methods=['POST'], website=True)
def post_delete(self, forum, post, **kwargs):