From 953a5509d23c098bcb9813343c475b8e4fa85f16 Mon Sep 17 00:00:00 2001 From: Denis Ledoux Date: Tue, 12 May 2015 11:27:59 +0200 Subject: [PATCH] [IMP] mail: use `has_group` to check a user is part of a group `has_groups` is more efficient, and won't lead to useless prefetches. opw-634402 --- addons/mail/mail_thread.py | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/addons/mail/mail_thread.py b/addons/mail/mail_thread.py index f778f6e4e80..e1eeaf772ca 100644 --- a/addons/mail/mail_thread.py +++ b/addons/mail/mail_thread.py @@ -340,9 +340,7 @@ class mail_thread(osv.AbstractModel): options = { 'display_log_button': False } - group_ids = self.pool.get('res.users').browse(cr, uid, uid, context=context).groups_id - group_user_id = self.pool.get("ir.model.data").get_object_reference(cr, uid, 'base', 'group_user')[1] - is_employee = group_user_id in [group.id for group in group_ids] + is_employee = self.pool['res.users'].has_group(cr, uid, 'base.group_user') if is_employee: options['display_log_button'] = True return options