From eedb831c0dad1bb12925931894d61f504570fd6a Mon Sep 17 00:00:00 2001 From: Christophe Simonis Date: Tue, 10 Jun 2014 16:11:11 +0200 Subject: [PATCH 1/4] [FIX] logging PostgreSQLHandler: mute sql_db logger to avoid logging loop if db connection or query failed --- openerp/netsvc.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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 From ddaac15f489d63110be089a5d2090a79fe60198c Mon Sep 17 00:00:00 2001 From: Martin Trigaux Date: Tue, 10 Jun 2014 16:48:19 +0200 Subject: [PATCH 2/4] [FIX] website_mail: backport of master fix a54caabbcb10a7db02f872ef5097ac379db5445f --- addons/website_mail/models/mail_thread.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addons/website_mail/models/mail_thread.py b/addons/website_mail/models/mail_thread.py index d7f750872ca..d4a37924b79 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 = { From de9654deec5afa7aa135ff45a4943e4421ff6efa Mon Sep 17 00:00:00 2001 From: Jonathan Nemry Date: Tue, 10 Jun 2014 16:57:54 +0200 Subject: [PATCH 3/4] [FIX] website_mail: default could be None --- addons/website_mail/models/mail_thread.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/addons/website_mail/models/mail_thread.py b/addons/website_mail/models/mail_thread.py index d4a37924b79..bea9178a335 100644 --- a/addons/website_mail/models/mail_thread.py +++ b/addons/website_mail/models/mail_thread.py @@ -37,5 +37,7 @@ class MailThread(osv.AbstractModel): } 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 From 907862655aea7db5eea3b27613c470e4afc5eaf5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Thibault=20Delavall=C3=A9e?= Date: Wed, 11 Jun 2014 13:56:23 +0200 Subject: [PATCH 4/4] [FIX] website_forum: people having enough karma can accepts answers on every question, not just their own. Fixed the condition computation. --- addons/website_forum/controllers/main.py | 6 +++--- addons/website_forum/static/src/js/website_forum.js | 7 +------ 2 files changed, 4 insertions(+), 9 deletions(-) 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");