From: Christophe Simonis Date: Tue, 21 Oct 2014 12:59:56 +0000 (+0200) Subject: [MERGE] forward port of branch 8.0 up to 262eb66 X-Git-Url: http://git.inspyration.org/?a=commitdiff_plain;h=a42167d085e8c4989412c39ec4e21685ebd93cd2;p=odoo%2Fodoo.git [MERGE] forward port of branch 8.0 up to 262eb66 --- a42167d085e8c4989412c39ec4e21685ebd93cd2 diff --cc addons/website_forum/models/forum.py index 5b1baa4,1bc9b69..e0b6061 --- a/addons/website_forum/models/forum.py +++ b/addons/website_forum/models/forum.py @@@ -357,14 -315,11 +358,14 @@@ class Post(osv.Model) context = {} create_context = dict(context, mail_create_nolog=True) post_id = super(Post, self).create(cr, uid, vals, context=create_context) - post = self.browse(cr, SUPERUSER_ID, post_id, context=context) # SUPERUSER_ID to avoid read access rights issues when creating + post = self.browse(cr, uid, post_id, context=context) + # deleted or closed questions + if post.parent_id and (post.parent_id.state == 'close' or post.parent_id.active == False): + osv.except_osv(_('Error !'), _('Posting answer on [Deleted] or [Closed] question is prohibited')) # karma-based access - if post.parent_id and not post.can_ask: + if not post.parent_id and not post.can_ask: raise KarmaError('Not enough karma to create a new question') - elif not post.parent_id and not post.can_answer: + elif post.parent_id and not post.can_answer: raise KarmaError('Not enough karma to answer to a question') # messaging and chatter base_url = self.pool['ir.config_parameter'].get_param(cr, uid, 'web.base.url') diff --cc addons/website_forum/views/website_forum.xml index 326c06c,9fbd27e..5372f84 --- a/addons/website_forum/views/website_forum.xml +++ b/addons/website_forum/views/website_forum.xml @@@ -111,22 -99,10 +111,22 @@@
-
- Ask a Question ++
+ + Ask a Question + Submit a Post + New Discussion + + + +

Keep Informed

@@@ -430,10 -326,14 +430,11 @@@
- +
- + -
@@@ -522,11 -412,15 +523,12 @@@ - no need to answer the same question twice. Also, please don't forget to vote - it really helps to select the best questions and answers!

-
+ -