summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThibault Delavallée <tde@openerp.com>2013-03-27 12:20:49 +0100
committerThibault Delavallée <tde@openerp.com>2013-03-27 12:20:49 +0100
commit9fa765194feef8caef812a5dfd95317c3f00d4ab (patch)
tree58c4510efb13940772d06278a605644338dbbb20
parent35b0b7f4b1656207560a470f776b9945dc176b30 (diff)
[CLEAN] Cleaned the fix.
bzr revid: tde@openerp.com-20130327112049-jmwcpwc50fsa6bf7
-rw-r--r--addons/mail/mail_message.py12
1 files changed, 9 insertions, 3 deletions
diff --git a/addons/mail/mail_message.py b/addons/mail/mail_message.py
index 156ceac214e..a8fba3022e1 100644
--- a/addons/mail/mail_message.py
+++ b/addons/mail/mail_message.py
@@ -265,19 +265,25 @@ class mail_message(osv.Model):
domain = [('partner_id', '=', user_pid), ('message_id', 'in', msg_ids)]
if not create_missing:
domain += [('starred', '=', not starred)]
+ values = {
+ 'starred': starred
+ }
+ if starred:
+ values['read'] = False
+
notif_ids = notification_obj.search(cr, uid, domain, context=context)
# all message have notifications: already set them as (un)starred
if len(notif_ids) == len(msg_ids) or not create_missing:
- notification_obj.write(cr, uid, notif_ids, {'starred': starred, 'read': False}, context=context)
+ notification_obj.write(cr, uid, notif_ids, values, context=context)
return starred
# some messages do not have notifications: find which one, create notification, update starred status
notified_msg_ids = [notification.message_id.id for notification in notification_obj.browse(cr, uid, notif_ids, context=context)]
to_create_msg_ids = list(set(msg_ids) - set(notified_msg_ids))
for msg_id in to_create_msg_ids:
- notification_obj.create(cr, uid, {'partner_id': user_pid, 'starred': starred, 'message_id': msg_id, 'read': False}, context=context)
- notification_obj.write(cr, uid, notif_ids, {'starred': starred, 'read': False}, context=context)
+ notification_obj.create(cr, uid, dict(values, partner_id=user_pid, message_id=msg_id), context=context)
+ notification_obj.write(cr, uid, notif_ids, values, context=context)
return starred
#------------------------------------------------------