diff --git a/addons/website_forum/controllers/main.py b/addons/website_forum/controllers/main.py index 81cbfdcadc8..2c6e234d653 100644 --- a/addons/website_forum/controllers/main.py +++ b/addons/website_forum/controllers/main.py @@ -346,10 +346,10 @@ class WebsiteForum(http.Controller): if not request.session.uid: return {'error': 'anonymous_user'} user = request.registry['res.users'].browse(request.cr, SUPERUSER_ID, request.uid, context=request.context) - if post.parent_id.create_uid.id != uid: - return {'error': 'own_post'} + if post.parent_id.create_uid.id != uid and user.karma < request.registry['forum.forum']._karma_answer_accept_all: + return {'error': 'not_enough_karma', 'karma': request.registry['forum.forum']._karma_answer_accept_all} if post.create_uid.id == user.id and user.karma < request.registry['forum.forum']._karma_answer_accept_own: - return {'error': 'not_enough_karma', 'karma': 20} + return {'error': 'not_enough_karma', 'karma': request.registry['forum.forum']._karma_answer_accept_own} # 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) diff --git a/addons/website_forum/static/src/js/website_forum.js b/addons/website_forum/static/src/js/website_forum.js index 0b45d4311c1..9d4e9e587c9 100644 --- a/addons/website_forum/static/src/js/website_forum.js +++ b/addons/website_forum/static/src/js/website_forum.js @@ -54,15 +54,10 @@ $(document).ready(function () { ''+ 'Sorry, anonymous users cannot choose correct answer.'+ ''); - } else if (data['error'] == 'own_post'){ - var $warning = $('
'+ - ''+ - 'Sorry, only the user who asked this question can accept the answer as correct.'+ - '
'); } else if (data['error'] == 'not_enough_karma') { var $warning = $('
'+ ''+ - 'Sorry, at least ' + data['karma'] + ' karma is required to accept your own answers. You can gain karma by answering questions and receiving votes.'+ + 'Sorry, at least ' + data['karma'] + ' karma is required to accept this answer. You can gain karma by answering questions and receiving votes.'+ '
'); } correct_answer_alert = $link.parent().find("#correct_answer_alert"); diff --git a/addons/website_mail/models/mail_thread.py b/addons/website_mail/models/mail_thread.py index d7f750872ca..bea9178a335 100644 --- a/addons/website_mail/models/mail_thread.py +++ b/addons/website_mail/models/mail_thread.py @@ -22,7 +22,7 @@ from openerp.osv import osv, fields # TODO for trunk, remove me -class MailThread(osv.Model): +class MailThread(osv.AbstractModel): _inherit = 'mail.thread' _columns = { @@ -37,5 +37,7 @@ class MailThread(osv.Model): } def copy(self, cr, uid, id, default=None, context=None): + if default is None: + default = {} default['website_message_ids'] = [] return super(MailThread, self).copy(cr, uid, id, default=default, context=context) \ No newline at end of file diff --git a/openerp/netsvc.py b/openerp/netsvc.py index c84228ea6e5..391de55a32e 100644 --- a/openerp/netsvc.py +++ b/openerp/netsvc.py @@ -78,7 +78,7 @@ class PostgreSQLHandler(logging.Handler): dbname = tools.config['log_db'] or ct_db if not dbname: return - with tools.ignore(Exception), sql_db.db_connect(dbname).cursor() as cr: + with tools.ignore(Exception), tools.mute_logger('openerp.sql_db'), sql_db.db_connect(dbname).cursor() as cr: msg = tools.ustr(record.msg) if record.args: msg = msg % record.args