account,account_report,base,product,scrum,stock,kernel: fix name_search
[odoo/odoo.git] / bin / addons / base / res / res_user.py
index cd2f6ce..3554a00 100644 (file)
@@ -120,10 +120,14 @@ class users(osv.osv):
                        raise osv.except_osv('Can not remove root user !', 'You can not remove the root user as it is used internally for resources created by Tiny ERP (updates, module installation, ...)')
                return super(users, self).unlink(cr, uid, ids)
                
-       def name_search(self, cr, user, name, args=[], operator='ilike', context={}):
-               ids = self.search(cr, user, [('login','=',name)]+ args)
+       def name_search(self, cr, user, name='', args=None, operator='ilike', context=None, limit=80):
+               if not args:
+                       args=[]
+               if not context:
+                       context={}
+               ids = self.search(cr, user, [('login','=',name)]+ args, limit=limit)
                if not ids:
-                       ids = self.search(cr, user, [('name',operator,name)]+ args)
+                       ids = self.search(cr, user, [('name',operator,name)]+ args, limit=limit)
                return self.name_get(cr, user, ids)
                
        def copy(self, cr, uid, id, default=None, context={}):