[FIX] website_sale: improve internal ref search
Problem: Results do not show when users search the internal reference of the product template on the ecommerce page if the product has other variants aside from itself. The search only searches internal reference of product variants and not the product template. Steps to reproduce on Runbot 15: - Install Sales and eCommerce - Create a product (can be sold), Set its Internal reference, and Add attributes and variants to the product --> Save Note: the internal ref of the product variants are not set by default - Go to ecommerce webpage and search the internal reference --> no product found Proposed solution: Add a condition to the domain to also search based on the internal reference of the product template opw-3212883 closes odoo/odoo#116771 X-original-commit: 5f0578059fe436d770e38ca90d8311ee80301878 Signed-off-by: Antoine Vandevenne (anv) <anv@odoo.com>
This commit is contained in:
@@ -467,10 +467,11 @@ class ProductTemplate(models.Model):
|
||||
ids = [value[1]]
|
||||
if attrib:
|
||||
domains.append([('attribute_line_ids.value_ids', 'in', ids)])
|
||||
search_fields = ['name', 'product_variant_ids.default_code']
|
||||
search_fields = ['name', 'default_code', 'product_variant_ids.default_code']
|
||||
fetch_fields = ['id', 'name', 'website_url']
|
||||
mapping = {
|
||||
'name': {'name': 'name', 'type': 'text', 'match': True},
|
||||
'default_code': {'name': 'default_code', 'type': 'text', 'match': True},
|
||||
'product_variant_ids.default_code': {'name': 'product_variant_ids.default_code', 'type': 'text', 'match': True},
|
||||
'website_url': {'name': 'website_url', 'type': 'text', 'truncate': False},
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user