Merge remote-tracking branch 'odoo/saas-5' into saas-5-report-translation-fix-sle

This commit is contained in:
Simon Lejeune
2014-06-11 23:07:28 +02:00
4 changed files with 8 additions and 11 deletions
+3 -3
View File
@@ -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)
@@ -54,15 +54,10 @@ $(document).ready(function () {
'<button type="button" class="close notification_close" data-dismiss="alert" aria-hidden="true">&times;</button>'+
'Sorry, anonymous users cannot choose correct answer.'+
'</div>');
} else if (data['error'] == 'own_post'){
var $warning = $('<div class="alert alert-danger alert-dismissable" id="correct_answer_alert" style="position:absolute; margin-top: -30px; margin-left: 90px;">'+
'<button type="button" class="close notification_close" data-dismiss="alert" aria-hidden="true">&times;</button>'+
'Sorry, only the user who asked this question can accept the answer as correct.'+
'</div>');
} else if (data['error'] == 'not_enough_karma') {
var $warning = $('<div class="alert alert-danger alert-dismissable" id="vote_alert" style="max-width: 500px; position:absolute; margin-top: -30px; margin-left: 90px;">'+
'<button type="button" class="close notification_close" data-dismiss="alert" aria-hidden="true">&times;</button>'+
'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.'+
'</div>');
}
correct_answer_alert = $link.parent().find("#correct_answer_alert");
+3 -1
View File
@@ -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)
+1 -1
View File
@@ -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