From 3d70fa89180cd3318b0f952c0f628d3bb1313340 Mon Sep 17 00:00:00 2001 From: Azka Nathan Date: Tue, 3 Sep 2024 09:24:33 +0700 Subject: add description_clean to solr --- indoteknik_custom/models/solr/product_template.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/indoteknik_custom/models/solr/product_template.py b/indoteknik_custom/models/solr/product_template.py index 9c5dc73e..b5fed4fa 100644 --- a/indoteknik_custom/models/solr/product_template.py +++ b/indoteknik_custom/models/solr/product_template.py @@ -1,4 +1,5 @@ from datetime import datetime +from bs4 import BeautifulSoup from odoo import api, fields, models @@ -78,6 +79,9 @@ class ProductTemplate(models.Model): is_in_bu = bool(stock_quant) + cleaned_desc = BeautifulSoup(template.website_description or '', "html.parser").get_text() + website_description = template.website_description if cleaned_desc else '' + document = solr_model.get_doc('product', template.id) document.update({ "id": template.id, @@ -105,6 +109,7 @@ class ProductTemplate(models.Model): "category_name_s": ', '.join(category_names), # Nama kategori sebagai string yang dipisahkan koma "category_name": category_names, # Nama kategori sebagai list "description_t": template.website_description or '', + "description_clean_t": website_description or '', 'has_product_info_b': True, 'publish_b': not template.unpublished, 'sni_b': template.unpublished, -- cgit v1.2.3