summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAzka Nathan <darizkyfaz@gmail.com>2024-10-10 10:39:19 +0700
committerAzka Nathan <darizkyfaz@gmail.com>2024-10-10 10:39:19 +0700
commit26c0d5bef2a175764a6df6eac9a92d89f99d57d7 (patch)
tree427d95cf5a7b38da016f7918f4c8cf4c0b251204
parent7153f047a6c9e98a1a016a6e08379f495071c9a1 (diff)
add clean description
-rwxr-xr-xindoteknik_custom/models/product_template.py7
1 files changed, 7 insertions, 0 deletions
diff --git a/indoteknik_custom/models/product_template.py b/indoteknik_custom/models/product_template.py
index 031d1b5b..af7f98cd 100755
--- a/indoteknik_custom/models/product_template.py
+++ b/indoteknik_custom/models/product_template.py
@@ -5,6 +5,7 @@ import logging
import requests
import json
import re
+from bs4 import BeautifulSoup
_logger = logging.getLogger(__name__)
@@ -363,6 +364,7 @@ class ProductProduct(models.Model):
specification = fields.Char(string='Specification')
material = fields.Char(string='Material')
qty_onhand_bandengan = fields.Float(string='Onhand BU', compute='_get_qty_onhand_bandengan')
+ clean_website_description = fields.Char(string='Clean Website Description', compute='_get_clean_website_description')
qty_incoming_bandengan = fields.Float(string='Incoming BU', compute='_get_qty_incoming_bandengan')
qty_outgoing_bandengan = fields.Float(string='Outgoing BU', compute='_get_qty_outgoing_bandengan')
qty_available_bandengan = fields.Float(string='Available BU', compute='_get_qty_available_bandengan')
@@ -373,6 +375,11 @@ class ProductProduct(models.Model):
qty_sold = fields.Float(string='Sold Quantity', compute='_get_qty_sold')
short_spesification = fields.Char(string='Short Spesification')
+ def _get_clean_website_description(self):
+ for rec in self:
+ cleaned_desc = BeautifulSoup(self.website_description or '', "html.parser").get_text()
+ rec.clean_website_description = cleaned_desc
+
@api.constrains('name', 'internal_reference', 'x_manufacture')
def required_public_categ_ids(self):
for rec in self: