[FIX] product: complete name_search

The name_search was not working properly if limit=None is specified (e.g.
searching for the search bar on a many2one field to product.template).

As `any int > None` is true, the condition is always validated as soon as the
search returns at least one result.
The product.product search has no limit parameter and use the default 100.
If the 100 first products have only a few templates (a lot of variants), the
result will be incomplete as stopping after the first iteration.

Closes #15477
This commit is contained in:
Florent de Labarre
2017-02-17 14:11:28 +01:00
committed by Martin Trigaux
parent 731569aed2
commit 942d8a2c3f
+1 -1
View File
@@ -322,7 +322,7 @@ class ProductTemplate(models.Model):
products_ns = Product.name_search(name, args+domain, operator=operator)
products = Product.browse([x[0] for x in products_ns])
templates |= products.mapped('product_tmpl_id')
if (not products) or (len(templates) > limit):
if (not products) or (limit and (len(templates) > limit)):
break
# re-apply product.template order + name_get