← Back to team overview

openerp-india team mailing list archive

[Bug 1043871] [NEW] OpenERP 6.1: base/res/res_users.py: The context ismissing in the name_search method

 

Public bug reported:

Hi,

in base/res/res_users.py, method name_search(), the parameter context is
missing in the methods search and name_get.

    def name_search(self, cr, user, name='', args=None, operator='ilike', context=None, limit=100):
        if not args:
            args=[]
        if not context:
            context={}
        ids = []
        if name:
            ids = self.search(cr, user, [('login','=',name)]+ args, limit=limit)
        if not ids:
            ids = self.search(cr, user, [('name',operator,name)]+ args, limit=limit)
        return self.name_get(cr, user, ids)


it should be:

    def name_search(self, cr, user, name='', args=None, operator='ilike', context=None, limit=100):
        if not args:
            args=[]
        if not context:
            context={}
        ids = []
        if name:
            ids = self.search(cr, user, [('login','=',name)]+ args, limit=limit, context=context)
        if not ids:
            ids = self.search(cr, user, [('name',operator,name)]+ args, limit=limit, context=context)
        return self.name_get(cr, user, ids, context=context)

** Affects: openobject-addons
     Importance: Undecided
         Status: New

-- 
You received this bug notification because you are a member of OpenERP
Indian Team, which is subscribed to OpenERP Addons.
https://bugs.launchpad.net/bugs/1043871

Title:
  OpenERP 6.1: base/res/res_users.py: The context ismissing in the
  name_search method

Status in OpenERP Addons (modules):
  New

Bug description:
  Hi,

  in base/res/res_users.py, method name_search(), the parameter context
  is missing in the methods search and name_get.

      def name_search(self, cr, user, name='', args=None, operator='ilike', context=None, limit=100):
          if not args:
              args=[]
          if not context:
              context={}
          ids = []
          if name:
              ids = self.search(cr, user, [('login','=',name)]+ args, limit=limit)
          if not ids:
              ids = self.search(cr, user, [('name',operator,name)]+ args, limit=limit)
          return self.name_get(cr, user, ids)

  
  it should be:

      def name_search(self, cr, user, name='', args=None, operator='ilike', context=None, limit=100):
          if not args:
              args=[]
          if not context:
              context={}
          ids = []
          if name:
              ids = self.search(cr, user, [('login','=',name)]+ args, limit=limit, context=context)
          if not ids:
              ids = self.search(cr, user, [('name',operator,name)]+ args, limit=limit, context=context)
          return self.name_get(cr, user, ids, context=context)

To manage notifications about this bug go to:
https://bugs.launchpad.net/openobject-addons/+bug/1043871/+subscriptions


Follow ups

References