From 049d85616de1cda7568cdb8ec2aed9192ed1206f Mon Sep 17 00:00:00 2001 From: "Turkesh Patel (Open ERP)" Date: Thu, 10 Apr 2014 18:19:50 +0530 Subject: [PATCH] [IMP] redirect to the comment when any comment posted, same thing for comment to answer and answer to comment. bzr revid: tpa@tinyerp.com-20140410124950-rnm040ag8ppop4kc --- addons/website_forum/controllers/main.py | 8 ++++---- addons/website_forum/views/website_forum.xml | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/addons/website_forum/controllers/main.py b/addons/website_forum/controllers/main.py index 968b26fc4fa..589d3e42da3 100644 --- a/addons/website_forum/controllers/main.py +++ b/addons/website_forum/controllers/main.py @@ -208,7 +208,7 @@ class website_forum(http.Controller): post = request.registry['website.forum.post'].browse(cr, uid, int(post_id), context=context) question_id = post.parent_id.id if post.parent_id else post.id - return werkzeug.utils.redirect("/forum/%s/question/%s" % (slug(forum),question_id)) + return werkzeug.utils.redirect("/forum/%s/question/%s#comments-%s" % (slug(forum), question_id, post.id)) @http.route(['/forum//user/'], type='http', auth="public", website=True, multilang=True) def open_user(self, forum, user, **post): @@ -339,7 +339,7 @@ class website_forum(http.Controller): request.registry['res.users'].write(cr, SUPERUSER_ID, uid, {'forum': True}, context=context) create_context = dict(context) - new_question_id = request.registry['website.forum.post'].create( + answer_id = request.registry['website.forum.post'].create( cr, uid, { 'forum_id': forum.id, 'user_id': uid, @@ -348,7 +348,7 @@ class website_forum(http.Controller): 'state': 'active', 'active': True, }, context=create_context) - return werkzeug.utils.redirect("/forum/%s/question/%s" % (slug(forum),post_id)) + return werkzeug.utils.redirect("/forum/%s/question/%s#answer-%s" % (slug(forum), post_id, answer_id)) @http.route(['/forum//question//editanswer'] , type='http', auth="user", website=True, multilang=True) @@ -411,7 +411,7 @@ class website_forum(http.Controller): vals.update({'tags': [(6, 0, question_tags)], 'name': post.get('question_name')}) post_id = post.get('answer_id') if post.get('answer_id') else post.get('question_id') - new_question_id = request.registry['website.forum.post'].write( cr, uid, [int(post_id)], vals, context=context) + request.registry['website.forum.post'].write( cr, uid, [int(post_id)], vals, context=context) return werkzeug.utils.redirect("/forum/%s/question/%s" % (slug(forum),post.get('question_id'))) @http.route(['/forum//tag'], type='http', auth="public", website=True, multilang=True) diff --git a/addons/website_forum/views/website_forum.xml b/addons/website_forum/views/website_forum.xml index 6b01baa0bd7..bc7dffc520d 100644 --- a/addons/website_forum/views/website_forum.xml +++ b/addons/website_forum/views/website_forum.xml @@ -542,7 +542,7 @@