From 83e8c54637e26bb2cc59a69b889f49ec56218272 Mon Sep 17 00:00:00 2001 From: Denis Ledoux Date: Fri, 3 Apr 2015 10:59:24 +0200 Subject: [PATCH] [FIX] product: import product.template fields using default_code This rev. is related to 489a96c2572bbe2cc04c0658ed2b862aca31fc0f It wasn't possible anymore to perform an import of a product.template field in a model (e.g. mrp.bom), while it should be the case. In the context of an import, the operator of the name_search is '='. Therefore, in this super call, the operator was '=' and the name was '' (empty). In such a case, ('name', '=', '') is added to the search domain by the base name_search method (in models.py), leading to the domain [('id', 'in', template_ids), ('name', '=', '')] which will lead to no results. Forcing 'ilike' as domain is correct, as the actual name_search, with the correct operator, has already been performed in the lines above, the point of this second name_search is to get the right order along with the right name_get. opw-632089 --- addons/product/product.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addons/product/product.py b/addons/product/product.py index 5a637f457d8..e7f9903f79b 100644 --- a/addons/product/product.py +++ b/addons/product/product.py @@ -816,7 +816,7 @@ class product_template(osv.osv): # re-apply product.template order + name_get return super(product_template, self).name_search( cr, user, '', args=[('id', 'in', template_ids)], - operator=operator, context=context, limit=limit) + operator='ilike', context=context, limit=limit) class product_product(osv.osv): _name = "product.product"