diff options
| author | Azka Nathan <darizkyfaz@gmail.com> | 2024-10-10 11:24:01 +0700 |
|---|---|---|
| committer | Azka Nathan <darizkyfaz@gmail.com> | 2024-10-10 11:24:01 +0700 |
| commit | ed9c28ad7062704cb9f124c7ba7b78eebe2695dc (patch) | |
| tree | 36f83efe744b0f273539d31c577243540bf6fc37 | |
| parent | 811d37923e235e12b2032e2acf93fc69c2a350a7 (diff) | |
cr line po
| -rwxr-xr-x | indoteknik_custom/models/purchase_order_line.py | 9 | ||||
| -rwxr-xr-x | indoteknik_custom/views/purchase_order.xml | 1 |
2 files changed, 9 insertions, 1 deletions
diff --git a/indoteknik_custom/models/purchase_order_line.py b/indoteknik_custom/models/purchase_order_line.py index fa300c67..9e7d7e81 100755 --- a/indoteknik_custom/models/purchase_order_line.py +++ b/indoteknik_custom/models/purchase_order_line.py @@ -3,6 +3,7 @@ from odoo.exceptions import AccessError, UserError, ValidationError from odoo.tools import DEFAULT_SERVER_DATETIME_FORMAT import logging from dateutil.relativedelta import relativedelta +from bs4 import BeautifulSoup from datetime import datetime _logger = logging.getLogger(__name__) @@ -38,11 +39,17 @@ class PurchaseOrderLine(models.Model): note = fields.Char(string='Note') sale_automatic_id = fields.Many2one('sale.order', string='SO') image_small = fields.Binary("Product Image", related="product_id.image_1920") - + clean_website_description_product = fields.Char(string='Clean Website Description Product', compute='_get_clean_website_description_product') qty_reserved = fields.Float(string='Qty Reserved', compute='_compute_qty_reserved') delete_line = fields.Boolean(string='Delete', default=False, help='centang ini jika anda ingin menghapus line ini') is_edit_product_qty = fields.Boolean(string='Is Edit Product Qty', compute='_compute_is_edit_product_qty') + def _get_clean_website_description_product(self): + for line in self: + description = line.product_id.website_description + description_clean = BeautifulSoup(description or '', "html.parser").get_text() + line.clean_website_description_product = description_clean + def _prepare_stock_move_vals(self, picking, price_unit, product_uom_qty, product_uom): self.ensure_one() product = self.product_id.with_context(lang=self.order_id.dest_address_id.lang or self.env.user.lang) diff --git a/indoteknik_custom/views/purchase_order.xml b/indoteknik_custom/views/purchase_order.xml index 1702db5d..3e609f15 100755 --- a/indoteknik_custom/views/purchase_order.xml +++ b/indoteknik_custom/views/purchase_order.xml @@ -65,6 +65,7 @@ <field name="qty_onhand" readonly="1" optional="hide"/> <field name="qty_incoming" readonly="1" optional="hide"/> <field name="qty_outgoing" readonly="1" optional="hide"/> + <field name="clean_website_description_product" readonly="1" optional="hide"/> <field name="qty_available" readonly="1" optional="hide"/> <field name="qty_reserved" readonly="1" optional="hide"/> <field name="suggest" readonly="1" widget="badge" decoration-danger="suggest == 'harus beli'" decoration-success="suggest == 'masih cukup'"/> |
