diff options
| author | it-fixcomart <it@fixcomart.co.id> | 2024-10-25 08:47:36 +0700 |
|---|---|---|
| committer | it-fixcomart <it@fixcomart.co.id> | 2024-10-25 08:47:36 +0700 |
| commit | 9fa80c62cdffec5b91aaf2a2899d70d0f507c2e4 (patch) | |
| tree | 93ae8d82f774345f650bc8d072dea759c6e33363 /indoteknik_custom/models/product_template.py | |
| parent | a21c5fe37529b2d2259d3b86d8e98730b2bc8513 (diff) | |
| parent | a7be93f4825967807f12e6bfbebcf090af8500fa (diff) | |
Merge branch 'production' into iman/switch-account
# Conflicts:
# indoteknik_api/controllers/api_v1/user.py
# indoteknik_custom/models/user_company_request.py
Diffstat (limited to 'indoteknik_custom/models/product_template.py')
| -rwxr-xr-x | indoteknik_custom/models/product_template.py | 8 |
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([ |
