summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThibault Delavallée <tde@openerp.com>2014-08-22 12:59:18 +0200
committerThibault Delavallée <tde@openerp.com>2014-08-22 13:36:54 +0200
commit3211ff7c780dcddf67278a3a616ecc84f9ad578a (patch)
tree0d5c193cfd46ac6789fa05e8bfff76f9ccb93549
parent10be95407a96e2bc7457b790213e42f9b0009a07 (diff)
[FIX] mail: when checking for possible messages to fetch, perform
a search_count on mail_message when the actual number of messages or their ids is not necessary, to speedup the computation.
-rw-r--r--addons/mail/mail_message.py4
1 files changed, 2 insertions, 2 deletions
diff --git a/addons/mail/mail_message.py b/addons/mail/mail_message.py
index 6413e1c090b..2529c4b8820 100644
--- a/addons/mail/mail_message.py
+++ b/addons/mail/mail_message.py
@@ -450,8 +450,8 @@ 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())]
- ids = self.search(cr, uid, exp_domain, context=context, limit=1)
- if ids:
+ more_count = self.search_count(cr, uid, exp_domain, context=context)
+ if more_count:
# inside a thread: prepend
if parent_id:
messages.insert(0, _get_expandable(exp_domain, -1, parent_id, True))