Activity log for bug #1028287

Date Who What changed Old value New value Message
2012-07-24 07:32:04 Francesco Apruzzese bug added bug
2012-07-24 10:48:48 Francesco Apruzzese description If i try to inherit name_search() function of product_product with super I obtain an error. I want to extend the arguments (args parameter) passed to the function but if I insert a "|" operator the code crash. The problem is in this line: 604 -> ids = self.search(cr, user, [('default_code','=',name)]+ args, limit=limit, context=context) 606 -> ids = self.search(cr, user, [('ean13','=',name)]+ args, limit=limit, context=context) 622 -> ids = self.search(cr, user, [('default_code','=', res.group(2))] + args, limit=limit, context=context) when the args parameter is built by adding "args" to an array. This is my code: def name_search(self, cr, user, name, args=None, operator='ilike', context=None, limit=100): if name: args = ['|', ('my_field', operator, name)] + args print args res = super(product_product,self).name_search(cr, user, name, args, operator='ilike', context=None, limit=100) return res If I print the args parameter at line 604 in product/product.py i read that args is: [('default_code','=',name),'|', ('my_field', operator, name)] and this is wrong. A simple solution is to invert the addends: 604 -> ids = self.search(cr, user, args + [('default_code','=',name)], limit=limit, context=context) 606 -> ids = self.search(cr, user,args + [('ean13','=',name)], limit=limit, context=context) 622 -> ids = self.search(cr, user,args + [('default_code','=', res.group(2))], limit=limit, context=context) If i try to inherit name_search() function of product_product with super I obtain an error. I want to extend the arguments (args parameter) passed to the function but if I insert a "|" operator the code crash. The problem is in this line: 604 -> ids = self.search(cr, user, [('default_code','=',name)]+ args, limit=limit, context=context) 606 -> ids = self.search(cr, user, [('ean13','=',name)]+ args, limit=limit, context=context) 622 -> ids = self.search(cr, user, [('default_code','=', res.group(2))] + args, limit=limit, context=context) when the args parameter is built by adding "args" to an array. This is my code: def name_search(self, cr, user, name, args=None, operator='ilike', context=None, limit=100):  if name:   args = ['|', ('my_field', operator, name)] + args   print args  res = super(product_product,self).name_search(cr, user, name, args, operator=operator, context=context, limit=limit)  return res If I print the args parameter at line 604 in product/product.py i read that args is: [('default_code','=',name),'|', ('my_field', operator, name)] and this is wrong. A simple solution is to invert the addends: 604 -> ids = self.search(cr, user, args + [('default_code','=',name)], limit=limit, context=context) 606 -> ids = self.search(cr, user,args + [('ean13','=',name)], limit=limit, context=context) 622 -> ids = self.search(cr, user,args + [('default_code','=', res.group(2))], limit=limit, context=context)
2012-07-24 10:52:06 Andrea Cometa bug added subscriber Andrea Cometa
2012-07-31 06:52:09 Amit Parik openobject-addons: importance Undecided Low
2012-07-31 06:52:09 Amit Parik openobject-addons: status New Confirmed
2012-07-31 06:52:09 Amit Parik openobject-addons: assignee OpenERP R&D Addons Team 2 (openerp-dev-addons2)
2012-08-06 10:39:53 Nicola Riolini - Micronaet bug added subscriber Nicola Riolini - Micronaet
2012-08-07 20:03:58 Launchpad Janitor branch linked lp:~scigghiateam/openerp/addons_6.1_merge_proposal
2012-08-08 08:58:52 Launchpad Janitor branch linked lp:~scigghiateam/openobject-addons/fix_bug_1028287
2012-08-08 09:09:32 Andrea Cometa branch unlinked lp:~scigghiateam/openerp/addons_6.1_merge_proposal