From f24d291e5147c824b355b4ece7ffc199fca12884 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Thibault=20Delavall=C3=A9e?= Date: Fri, 16 Nov 2012 10:50:03 +0100 Subject: [PATCH] [FIX] mail_thread: fixed calculation of message_unread: read field may be False or NULL. bzr revid: tde@openerp.com-20121116095003-8bbfyyvlhzqehf6h --- addons/mail/mail_thread.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addons/mail/mail_thread.py b/addons/mail/mail_thread.py index ee1a015396b..c5da22297f9 100644 --- a/addons/mail/mail_thread.py +++ b/addons/mail/mail_thread.py @@ -79,7 +79,7 @@ class mail_thread(osv.AbstractModel): # search for unread messages, directly in SQL to improve performances cr.execute(""" SELECT m.res_id FROM mail_message m RIGHT JOIN mail_notification n - ON (n.message_id = m.id AND n.partner_id = %s AND n.read = False) + ON (n.message_id = m.id AND n.partner_id = %s AND (n.read = False or n.read IS NULL)) WHERE m.model = %s AND m.res_id in %s""", (user_pid, self._name, tuple(ids),)) msg_ids = [result[0] for result in cr.fetchall()]