[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:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user