summaryrefslogtreecommitdiff
path: root/indoteknik_custom/models/product_template.py
diff options
context:
space:
mode:
Diffstat (limited to 'indoteknik_custom/models/product_template.py')
-rwxr-xr-xindoteknik_custom/models/product_template.py8
1 files changed, 8 insertions, 0 deletions
diff --git a/indoteknik_custom/models/product_template.py b/indoteknik_custom/models/product_template.py
index 031d1b5b..2ca4925b 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:
@@ -398,6 +405,7 @@ class ProductProduct(models.Model):
continue
if any(variant.active for variant in variants):
product_template.unpublished = False
+ variants.unpublished = False
def update_internal_reference_variants(self, limit=100):
variants = self.env['product.product'].search([