[FIX] res.users: no global var for filtering groups, rather an overridable method

bzr revid: odo@openerp.com-20111215154048-qz7o4qqj9d1g439k
This commit is contained in:
Olivier Dony 2011-12-15 16:40:48 +01:00
parent 5e0cf3080d
commit 525d60523e
1 changed files with 4 additions and 4 deletions

View File

@ -698,9 +698,6 @@ def partition(f, xs):
class groups_view(osv.osv): class groups_view(osv.osv):
_inherit = 'res.groups' _inherit = 'res.groups'
# this defines a domain for searching all groups in get_groups_by_application()
groups_by_application_domain = []
def create(self, cr, uid, values, context=None): def create(self, cr, uid, values, context=None):
res = super(groups_view, self).create(cr, uid, values, context) res = super(groups_view, self).create(cr, uid, values, context)
self.update_user_groups_view(cr, uid, context) self.update_user_groups_view(cr, uid, context)
@ -754,6 +751,9 @@ class groups_view(osv.osv):
view = False view = False
return view return view
def get_application_groups(self, cr, uid, domain=None, context=None):
return self.search(cr, uid, domain or [])
def get_groups_by_application(self, cr, uid, context=None): def get_groups_by_application(self, cr, uid, context=None):
""" return all groups classified by application (module category), as a list of pairs: """ return all groups classified by application (module category), as a list of pairs:
[(app, kind, [group, ...]), ...], [(app, kind, [group, ...]), ...],
@ -774,7 +774,7 @@ class groups_view(osv.osv):
return None return None
# classify all groups by application # classify all groups by application
gids = self.search(cr, uid, self.groups_by_application_domain) gids = self.get_application_groups(cr, uid, context=context)
by_app, others = {}, [] by_app, others = {}, []
for g in self.browse(cr, uid, gids, context): for g in self.browse(cr, uid, gids, context):
if g.category_id: if g.category_id: