diff --git a/addons/product/models/product_template.py b/addons/product/models/product_template.py index 7902b351c01..88cfb214baf 100644 --- a/addons/product/models/product_template.py +++ b/addons/product/models/product_template.py @@ -540,7 +540,10 @@ class ProductTemplate(models.Model): while True: domain = templates and [('product_tmpl_id', 'not in', templates.ids)] or [] args = args if args is not None else [] - products_ids = Product._name_search(name, args+domain, operator=operator, name_get_uid=name_get_uid) + # Product._name_search has default value limit=100 + # So, we either use that value or override it to None to fetch all products at once + kwargs = {} if limit else {'limit': None} + products_ids = Product._name_search(name, args+domain, operator=operator, name_get_uid=name_get_uid, **kwargs) products = Product.browse(products_ids) new_templates = products.mapped('product_tmpl_id') if new_templates & templates: