From e20c70977c76ebf487bba4a78bc74f2a84463a7f Mon Sep 17 00:00:00 2001 From: Florian Damhaut Date: Thu, 27 Jan 2022 15:07:07 +0000 Subject: [PATCH] [FIX] website_sale: searchbar also search product code Step to reproduce: - Search code of product in website_sale search bar Current Bheaviour: - No result Behaviour after PR: - Search also try to match , similar behaviour to V14 and before opw-2737648 closes odoo/odoo#86921 X-original-commit: 395643d1377750577f3588506035623f9d0489c9 Signed-off-by: Yannick Tivisse (yti) --- addons/website_sale/models/product_template.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/addons/website_sale/models/product_template.py b/addons/website_sale/models/product_template.py index 6747b885dde..6981085a9ac 100644 --- a/addons/website_sale/models/product_template.py +++ b/addons/website_sale/models/product_template.py @@ -415,10 +415,11 @@ class ProductTemplate(models.Model): ids = [value[1]] if attrib: domains.append([('attribute_line_ids.value_ids', 'in', ids)]) - search_fields = ['name'] + search_fields = ['name', 'product_variant_ids.default_code'] fetch_fields = ['id', 'name', 'website_url'] mapping = { 'name': {'name': 'name', '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}, } if with_image: