summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAzka Nathan <darizkyfaz@gmail.com>2024-09-03 09:24:33 +0700
committerAzka Nathan <darizkyfaz@gmail.com>2024-09-03 09:24:33 +0700
commit3d70fa89180cd3318b0f952c0f628d3bb1313340 (patch)
treec947540fe091a4864b453bc2271503c53065e8ac
parentc9621e309e9b9db20ac01359b9369fa2d2a32024 (diff)
add description_clean to solr
-rw-r--r--indoteknik_custom/models/solr/product_template.py5
1 files changed, 5 insertions, 0 deletions
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,