[MERGE] Merged branch holding the automatic set of notifications as read when viewing chatter.
bzr revid: tde@openerp.com-20121220133839-je1jt9ff4a0mfpxh
This commit is contained in:
commit
8dbf13a1e4
|
@ -134,7 +134,10 @@ class mail_group(osv.Model):
|
|||
params = {
|
||||
'search_view_id': search_ref and search_ref[1] or False,
|
||||
'domain': [('model', '=', 'mail.group'), ('res_id', '=', mail_group_id)],
|
||||
'context': {'default_model': 'mail.group', 'default_res_id': mail_group_id, 'search_default_message_unread': True},
|
||||
'context': {'default_model': 'mail.group',
|
||||
'default_res_id': mail_group_id,
|
||||
'search_default_message_unread': True,
|
||||
'mail_read_keep_unread':True},
|
||||
'res_model': 'mail.message',
|
||||
'thread_level': 1,
|
||||
'header_description': vals.get('description'),
|
||||
|
|
|
@ -501,6 +501,11 @@ class mail_message(osv.Model):
|
|||
if ids is None:
|
||||
ids = self.search(cr, uid, domain, context=context, limit=limit)
|
||||
|
||||
# if requested: mark messages as read
|
||||
if context and context.has_key('mail_read_set_read'):
|
||||
notif_ids = notif_obj.search(cr, uid, [('message_id', '=', msg.id)], context=context)
|
||||
notif_obj.write(cr, uid, notif_ids, {'read': True}, context=context)
|
||||
|
||||
# fetch parent if threaded, sort messages
|
||||
for message in self.browse(cr, uid, ids, context=context):
|
||||
message_id = message.id
|
||||
|
|
|
@ -80,6 +80,14 @@ class test_mail_access_rights(TestMailBase):
|
|||
elif msg.get('type') == 'expandable':
|
||||
new_msg_exp = msg
|
||||
|
||||
# #check notification For message readable or unread.
|
||||
# notif_msg1_ids1 = self.mail_notification.search(cr, uid, [('partner_id', '=', user_bert.partner_id.id),('message_id', '=', message1.id)], context=context)
|
||||
# notif_data1 = self.mail_notification.read(cr, uid, notif_msg1_ids1, ['read'])[0]['read']
|
||||
# # Test: Message1 are marked as read.
|
||||
# self.assertTrue(notif_data1, 'Message1 are set as read for the user Bert that read it')
|
||||
# #Pass key in context for unread message..
|
||||
# context.update({'default_model': 'mail.group', 'default_res_id': [self.group_pigs_id], 'mail_keep_unread': True})
|
||||
|
||||
# Do: fetch new messages in first thread, domain from expandable
|
||||
self.assertIsNotNone(new_msg_exp, 'message_read on last Pigs message should have returned a new messages expandable')
|
||||
domain = new_msg_exp.get('domain', [])
|
||||
|
|
Loading…
Reference in New Issue