I want to stop the website search from searching the 'sales description' field. Any suggestions would be very much appreciated.
I am on Odoo v17 Enterprise on premise.
I want to stop the website search from searching the 'sales description' field. Any suggestions would be very much appreciated.
I am on Odoo v17 Enterprise on premise.
Hi,
In odoo 17 you can check addons code
website_sale/models/product_template.py
check this method
def _search_get_detail
@api.model
def _search_get_detail(self, website, order, options):
with_image = options['displayImage']
# with_description = options['displayDescription']
with_category = options['displayExtraLink']
with_price = options['displayDetail']
domains = [website.sale_product_domain()]
category = options.get('category')
tags = options.get('tags')
min_price = options.get('min_price')
max_price = options.get('max_price')
attrib_values = options.get('attrib_values')
if category:
domains.append([('public_categ_ids', 'child_of', unslug(category)[1])])
if tags:
if isinstance(tags, str):
tags = tags.split(',')
domains.append([('product_variant_ids.all_product_tag_ids', 'in', tags)])
if min_price:
domains.append([('list_price', '>=', min_price)])
if max_price:
domains.append([('list_price', '<=', max_price)])
if attrib_values:
attrib = None
ids = []
for value in attrib_values:
if not attrib:
attrib = value[0]
ids.append(value[1])
elif value[0] == attrib:
ids.append(value[1])
else:
domains.append([('attribute_line_ids.value_ids', 'in', ids)])
attrib = value[0]
ids = [value[1]]
if attrib:
domains.append([('attribute_line_ids.value_ids', 'in', ids)])
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},
}
if with_image:
mapping['image_url'] = {'name': 'image_url', 'type': 'html'}
# if with_description:
# # Internal note is not part of the rendering.
# search_fields.append('description')
# fetch_fields.append('description')
# search_fields.append('description_sale')
# fetch_fields.append('description_sale')
# mapping['description'] = {'name': 'description_sale', 'type': 'text', 'match': True}
if with_price:
mapping['detail'] = {'name': 'price', 'type': 'html', 'display_currency': options['display_currency']}
mapping['detail_strike'] = {'name': 'list_price', 'type': 'html', 'display_currency': options['display_currency']}
if with_category:
mapping['extra_link'] = {'name': 'category', 'type': 'html'}
return {
'model': 'product.template',
'base_domain': domains,
'search_fields': search_fields,
'fetch_fields': fetch_fields,
'mapping': mapping,
'icon': 'fa-shopping-cart',
}
Comment out
with_description = options['displayDescription']
condition code and check then override this method in your custom module.
Thanks.
Erstellen Sie heute ein Konto, um exklusive Funktionen zu nutzen und mit unserer tollen Community zu interagieren!
Registrieren| Verknüpfte Beiträge | Antworten | Ansichten | Aktivität | |
|---|---|---|---|---|
|
Website Search bar
Gelöst
|
3
Apr. 25
|
10288 | ||
|
2
Sept. 24
|
2435 | |||
|
1
Juli 23
|
2898 | |||
|
Enable google search console
Gelöst
|
3
Jan. 24
|
23429 | ||
|
|
0
Mai 21
|
6632 |
1. Use the live chat to ask your questions.
2. The operator answers within a few minutes.