From f6b6fb4debcd02918c8a4b172227e6331d38fdc5 Mon Sep 17 00:00:00 2001 From: Fabien Pinckaers Date: Wed, 22 Aug 2012 17:59:54 +0200 Subject: [PATCH] [FIX] needaction ok for crm bzr revid: fp@tinyerp.com-20120822155954-8ix4op6hj5e5hzi5 --- addons/mail/mail_thread.py | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/addons/mail/mail_thread.py b/addons/mail/mail_thread.py index 1be8dfdbf0c..f7078348f08 100644 --- a/addons/mail/mail_thread.py +++ b/addons/mail/mail_thread.py @@ -87,8 +87,18 @@ class mail_thread(osv.Model): return res # FP Note: todo - def _search_unread(self, tobj, cr, uid, obj=None, name=None, domain=None, context=None): - return [] + def _search_unread(self, cr, uid, obj=None, name=None, domain=None, context=None): + partner_id = self.pool.get('res.users').browse(cr, uid, uid, context=context).partner_id.id + res = {} + notif_obj = self.pool.get('mail.notification') + notif_ids = notif_obj.search(cr, uid, [ + ('partner_id', '=', partner_id), + ('message_id.model', '=', self._name), + ('read', '=', False) + ], context=context) + for notif in notif_obj.browse(cr, uid, notif_ids, context=context): + res[notif.message_id.res_id] = True + return [('id','in',res.keys())] _columns = { 'message_is_follower': fields.function(_get_message_data,