From 859eb2511e3c319c082847b18daefbd799103ae2 Mon Sep 17 00:00:00 2001 From: mariuszmizgier Date: Sat, 16 May 2015 15:35:07 +0200 Subject: [PATCH] [FIX] mail: Mail message performance improvement As of version 8.0, search_count method has been implemented Usage in this place is not needed though, as we just need to know if there are messages in domain, not the exact number of them. Due to that we replace method search_count with search and add a limit of 1, which provides better performances. Fixes #6670 Closes #6679 --- addons/mail/mail_message.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addons/mail/mail_message.py b/addons/mail/mail_message.py index 5874ac962f0..fbd04f21acc 100644 --- a/addons/mail/mail_message.py +++ b/addons/mail/mail_message.py @@ -452,7 +452,7 @@ class mail_message(osv.Model): exp_domain = domain + [('id', '<', min(message_unload_ids + message_ids))] else: exp_domain = domain + ['!', ('id', 'child_of', message_unload_ids + parent_tree.keys())] - more_count = self.search_count(cr, uid, exp_domain, context=context) + more_count = self.search(cr, uid, exp_domain, context=context, limit=1) if more_count: # inside a thread: prepend if parent_id: