[IMP] res_users: improve get_groups_by_application
bzr revid: rco@openerp.com-20111209092700-v7vbcgmliydmo6up
This commit is contained in:
parent
823c79f510
commit
251dc86e67
|
@ -752,11 +752,11 @@ class groups_view(osv.osv):
|
||||||
return view
|
return view
|
||||||
|
|
||||||
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, as a list of pairs:
|
""" return all groups classified by application (module category), as a list of pairs:
|
||||||
[(app, kind, [group, ...]), ...],
|
[(app, kind, [group, ...]), ...],
|
||||||
where app and group are browse records, and kind is either 'boolean' or 'selection'.
|
where app and group are browse records, and kind is either 'boolean' or 'selection'.
|
||||||
Applications are given in sequence order. If kind is 'selection', the groups are
|
Applications are given in sequence order. If kind is 'selection', the groups are
|
||||||
given in reverse implication order; otherwise they are given in alphabetic order.
|
given in reverse implication order.
|
||||||
"""
|
"""
|
||||||
def linearized(gs):
|
def linearized(gs):
|
||||||
gs = set(gs)
|
gs = set(gs)
|
||||||
|
@ -785,9 +785,9 @@ class groups_view(osv.osv):
|
||||||
if gs:
|
if gs:
|
||||||
res.append((app, 'selection', gs))
|
res.append((app, 'selection', gs))
|
||||||
else:
|
else:
|
||||||
res.append((app, 'boolean', sorted(by_app[app], key=lambda g: g.name)))
|
res.append((app, 'boolean', by_app[app]))
|
||||||
if others:
|
if others:
|
||||||
res.append((False, 'boolean', sorted(others, key=lambda g: g.name)))
|
res.append((False, 'boolean', others))
|
||||||
return res
|
return res
|
||||||
|
|
||||||
groups_view()
|
groups_view()
|
||||||
|
|
Loading…
Reference in New Issue