[IMP] set messages read when viewing chatter: search only unread notifications.

bzr revid: tde@openerp.com-20121220143527-y98r2hftskgb9e3g
This commit is contained in:
Thibault Delavallée 2012-12-20 15:35:27 +01:00
parent a8540c5b7e
commit b127484733
1 changed files with 2 additions and 2 deletions

View File

@ -538,8 +538,8 @@ class mail_message(osv.Model):
# if requested: mark messages as read
if context and context.get('mail_read_set_read'):
message_ids = [message.get('id') for message in message_list]
notif_ids = notification_obj.search(cr, uid, [('partner_id.user_ids', 'in', uid), ('message_id', 'in', message_ids)], context=context)
notification_obj.write(cr, uid, notif_ids, {'read': True}, context=context)
unread_notif_ids = notification_obj.search(cr, uid, [('read', '=', False), ('partner_id.user_ids', 'in', uid), ('message_id', 'in', message_ids)], context=context)
notification_obj.write(cr, uid, unread_notif_ids, {'read': True}, context=context)
# get the child expandable messages for the tree
self._message_read_dict_postprocess(cr, uid, message_list, message_tree, context=context)