[FIX] thread widget: fixed a bug with array union instead of concatenation, leading to a wrong domain given to fetch method.

bzr revid: tde@openerp.com-20120403133859-scc2ctgut3ygsc9y
This commit is contained in:
Thibault Delavallée 2012-04-03 15:38:59 +02:00
parent 4cd7d083d6
commit a85efef0b6
2 changed files with 4 additions and 5 deletions

View File

@ -383,7 +383,7 @@ class mail_thread(osv.osv):
msg_ids = self.message_load_ids(cr, uid, ids, limit, offset, domain, ascent, root_ids, context=context)
return self.pool.get('mail.message').read(cr, uid, msg_ids, context=context)
def get_pushed_messages(self, cr, uid, ids, limit=100, offset=0, notif_search_domain=[], msg_search_domain=[], ascent=False, root_ids=[], context=None):
def get_pushed_messages(self, cr, uid, ids, limit=100, offset=0, msg_search_domain=[], ascent=False, root_ids=[], context=None):
""" OpenChatter: wall: get messages to display (=pushed notifications)
:param domain: domain to add to the search; especially child_of
is interesting when dealing with threaded display
@ -400,8 +400,7 @@ class mail_thread(osv.osv):
if isinstance(arg, (tuple, list)):
arg[0] = 'message_id.' + arg[0]
# compose final domain
domain = [('user_id', '=', uid)] + notif_search_domain + msg_search_domain
#print domain
domain = [('user_id', '=', uid)] + msg_search_domain
# get notifications
notification_ids = notification_obj.search(cr, uid, domain, limit=limit, offset=offset, context=context)
notifications = notification_obj.browse(cr, uid, notification_ids, context=context)

View File

@ -647,12 +647,12 @@ openerp.mail = function(session) {
*/
fetch_comments: function (limit, offset, additional_domain, additional_context) {
var self = this;
if (additional_domain) var fetch_domain = _.union(this.params.search['domain'], additional_domain);
if (additional_domain) var fetch_domain = this.params.search['domain'].concat(additional_domain);
else var fetch_domain = this.params.search['domain'];
if (additional_context) var fetch_context = _.extend(this.params.search['context'], additional_context);
else var fetch_context = this.params.search['context'];
var load_res = this.ds_thread.call('get_pushed_messages',
[[this.session.uid], (limit || 0), (offset || 0), [], fetch_domain, true, [], fetch_context]).then(function (records) {
[[this.session.uid], (limit || 0), (offset || 0), fetch_domain, true, [], fetch_context]).then(function (records) {
self.do_update_show_more(records.length >= self.params.limit);
self.display_comments(records);
});