From 4b1cae0b9e8ba1e0f0c8d5df96775a90b6f6f719 Mon Sep 17 00:00:00 2001 From: snt Date: Wed, 18 Sep 2024 17:57:08 +0200 Subject: [PATCH] =?UTF-8?q?busca=20por=20autor,=20editorial=20y=20subt?= =?UTF-8?q?=C3=ADtulo=20en=20la=20web=20y=20quita=20las=20descripciones=20?= =?UTF-8?q?de=20la=20b=C3=BAsqueda?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- website_sale_product_library/__init__.py | 3 ++- website_sale_product_library/models/__init__.py | 1 + .../models/product_template.py | 17 +++++++++++++++++ 3 files changed, 20 insertions(+), 1 deletion(-) create mode 100644 website_sale_product_library/models/__init__.py create mode 100644 website_sale_product_library/models/product_template.py diff --git a/website_sale_product_library/__init__.py b/website_sale_product_library/__init__.py index c05036f..899bcc9 100644 --- a/website_sale_product_library/__init__.py +++ b/website_sale_product_library/__init__.py @@ -1 +1,2 @@ -#from . import controllers +from . import models + diff --git a/website_sale_product_library/models/__init__.py b/website_sale_product_library/models/__init__.py new file mode 100644 index 0000000..510f3bd --- /dev/null +++ b/website_sale_product_library/models/__init__.py @@ -0,0 +1 @@ +from . import product_template \ No newline at end of file diff --git a/website_sale_product_library/models/product_template.py b/website_sale_product_library/models/product_template.py new file mode 100644 index 0000000..8a87056 --- /dev/null +++ b/website_sale_product_library/models/product_template.py @@ -0,0 +1,17 @@ +from odoo import api, models, fields + +class ProductTemplate(models.Model): + _inherit = 'product.template' + + @api.model + def _search_get_detail(self, website, order, options): + search_details = super()._search_get_detail(website, order, options) + search_details['search_fields'].append('autor') + search_details['fetch_fields'].append('autor') + search_details['search_fields'].append('editorial') + search_details['fetch_fields'].append('editorial') + search_details['search_fields'].append('subtitle') + search_details['fetch_fields'].append('subtitle') + search_details['search_fields'].remove('description') + search_details['search_fields'].remove('description_sale') + return search_details \ No newline at end of file