[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
This commit is contained in:
parent
73432ffe9f
commit
953a5509d2
|
@ -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
|
||||
|
|
Loading…
Reference in New Issue