=== modified file 'product/product.py' --- product/product.py 2009-03-06 22:18:24 +0000 +++ product/product.py 2009-05-07 11:28:55 +0000 @@ -1,7 +1,7 @@ # -*- encoding: utf-8 -*- ############################################################################## # -# OpenERP, Open Source Management Solution +# OpenERP, Open Source Management Solution # Copyright (C) 2004-2009 Tiny SPRL (). All Rights Reserved # $Id$ # @@ -497,13 +497,17 @@ args=[] if not context: context={} - ids = self.search(cr, user, [('default_code','=',name)]+ args, limit=limit, context=context) - if not len(ids): - ids = self.search(cr, user, [('ean13','=',name)]+ args, limit=limit, context=context) - if not len(ids): - ids = self.search(cr, user, [('default_code',operator,name)]+ args, limit=limit, context=context) - ids += self.search(cr, user, [('name',operator,name)]+ args, limit=limit, context=context) - result = self.name_get(cr, user, ids, context) + if name : + ids = self.search(cr, user, [('default_code','=',name)]+ args, limit=limit, context=context) + if not len(ids): + ids = self.search(cr, user, [('ean13','=',name)]+ args, limit=limit, context=context) + if not len(ids): + ids = self.search(cr, user, [('default_code',operator,name)]+ args, limit=limit, context=context) + ids += self.search(cr, user, [('name',operator,name)]+ args, limit=limit, context=context) + result = self.name_get(cr, user, ids, context) + else : + ids = self.search(cr, user, [], limit=limit, context=context) + result = self.name_get(cr, user, ids, context) return result #