[IMP] res_users: add domain when searching for groups by application
authorRaphael Collet <rco@openerp.com>
Fri, 9 Dec 2011 12:48:21 +0000 (13:48 +0100)
committerRaphael Collet <rco@openerp.com>
Fri, 9 Dec 2011 12:48:21 +0000 (13:48 +0100)
bzr revid: rco@openerp.com-20111209124821-vcvsjlwacb3xtz90

openerp/addons/base/res/res_users.py

index b808db4..1d898d0 100644 (file)
@@ -698,6 +698,9 @@ def partition(f, xs):
 class groups_view(osv.osv):
     _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):
         res = super(groups_view, self).create(cr, uid, values, context)
         self.update_user_groups_view(cr, uid, context)
@@ -771,8 +774,9 @@ class groups_view(osv.osv):
             return None
 
         # classify all groups by application
+        gids = self.search(cr, uid, self.groups_by_application_domain)
         by_app, others = {}, []
-        for g in self.browse(cr, uid, self.search(cr, uid, []), context):
+        for g in self.browse(cr, uid, gids, context):
             if g.category_id:
                 by_app.setdefault(g.category_id, []).append(g)
             else: