[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
This commit is contained in:
mariuszmizgier 2015-05-16 15:35:07 +02:00 committed by Denis Ledoux
parent bdc4c5a55e
commit 859eb2511e
1 changed files with 1 additions and 1 deletions

View File

@ -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: