Skip to content

Commit

Permalink
[IMP] base: avoid useless recomputation of "share" column on res.users
Browse files Browse the repository at this point in the history
  • Loading branch information
KangOl committed Oct 8, 2015
1 parent 91aa012 commit 85f6b7c
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions openerp/addons/base/res/res_users.py
Original file line number Diff line number Diff line change
Expand Up @@ -167,6 +167,8 @@ def _get_users_from_group(self, cr, uid, ids, context=None):
groups = self.pool['res.groups'].browse(cr, uid, ids, context=context)
# Clear cache to avoid perf degradation on databases with thousands of users
groups.invalidate_cache()
group_user = self.pool['ir.model.data'].xmlid_to_object(cr, SUPERUSER_ID, 'base.group_user', context=context)
groups = [g for g in groups if g == group_user or group_user in g.trans_implied_ids]
for group in groups:
result.update(user.id for user in group.users)
return list(result)
Expand Down Expand Up @@ -197,8 +199,8 @@ def _get_users_from_group(self, cr, uid, ids, context=None):
'company_ids':fields.many2many('res.company','res_company_users_rel','user_id','cid','Companies'),
'share': fields.function(_is_share, string='Share User', type='boolean',
store={
'res.users': (lambda self, cr, uid, ids, c={}: ids, None, 50),
'res.groups': (_get_users_from_group, None, 50),
'res.users': (lambda self, cr, uid, ids, c={}: ids, ['groups_id'], 50),
'res.groups': (_get_users_from_group, ['users'], 50),
}, help="External user with limited access, created only for the purpose of sharing data."),
}

Expand Down

0 comments on commit 85f6b7c

Please sign in to comment.