diff options
| author | Azka Nathan <darizkyfaz@gmail.com> | 2024-06-06 10:45:47 +0700 |
|---|---|---|
| committer | Azka Nathan <darizkyfaz@gmail.com> | 2024-06-06 10:45:47 +0700 |
| commit | 00ebebce72441282bae3494088b9d6dd28df6e97 (patch) | |
| tree | a044ed69f7715c1008c4fc2a90b1b5a285ad0b8a | |
| parent | 9acb6bc2039b7004105a1987be8002c4067f85f9 (diff) | |
add short_spesification on product variant, fix note detail purchasing job
| -rwxr-xr-x | indoteknik_custom/models/product_template.py | 2 | ||||
| -rwxr-xr-x | indoteknik_custom/models/purchase_order.py | 13 | ||||
| -rw-r--r-- | indoteknik_custom/models/sale_order_line.py | 6 | ||||
| -rw-r--r-- | indoteknik_custom/models/solr/product_product.py | 2 | ||||
| -rw-r--r-- | indoteknik_custom/models/solr/product_template.py | 2 | ||||
| -rwxr-xr-x | indoteknik_custom/views/product_template.xml | 1 |
6 files changed, 26 insertions, 0 deletions
diff --git a/indoteknik_custom/models/product_template.py b/indoteknik_custom/models/product_template.py index d490eb05..c94b523a 100755 --- a/indoteknik_custom/models/product_template.py +++ b/indoteknik_custom/models/product_template.py @@ -59,6 +59,7 @@ class ProductTemplate(models.Model): ], string='Kind of', copy=False) sni = fields.Boolean(string='SNI') tkdn = fields.Boolean(string='TKDN') + short_spesification = fields.Char(string='Short Spesification') def _get_qty_sold(self): for rec in self: @@ -351,6 +352,7 @@ class ProductProduct(models.Model): sla_version = fields.Integer(string="SLA Version", default=0) is_edited = fields.Boolean(string='Is Edited') qty_sold = fields.Float(string='Sold Quantity', compute='_get_qty_sold') + short_spesification = fields.Char(string='Short Spesification') def update_internal_reference_variants(self, limit=100): variants = self.env['product.product'].search([ diff --git a/indoteknik_custom/models/purchase_order.py b/indoteknik_custom/models/purchase_order.py index 5946399d..3a959391 100755 --- a/indoteknik_custom/models/purchase_order.py +++ b/indoteknik_custom/models/purchase_order.py @@ -388,9 +388,22 @@ class PurchaseOrder(models.Model): delta_time = delta_time.strftime('%Y-%m-%d %H:%M:%S') self.date_planned = delta_time self.date_deadline_ref_date_planned() + self.unlink_purchasing_job_state() return res + def unlink_purchasing_job_state(self): + for line in self.order_line: + purchasing_job_state = self.env['purchasing.job.state'].search([ + ('purchasing_job_id', '=', line.product_id.id) + ]) + + if purchasing_job_state: + for purchasing_job in purchasing_job_state: + purchasing_job.unlink() + + + def _send_po_not_sync(self): # Mengirim data ke model Po Sync Price jika harga po dan purchase pricelist tidak singkron for line in self.order_line: diff --git a/indoteknik_custom/models/sale_order_line.py b/indoteknik_custom/models/sale_order_line.py index 11346fc9..d58157ee 100644 --- a/indoteknik_custom/models/sale_order_line.py +++ b/indoteknik_custom/models/sale_order_line.py @@ -142,6 +142,12 @@ class SaleOrderLine(models.Model): line.tax_id = line.order_id.sales_tax_id line.purchase_price = self._get_valid_purchase_price(purchase_price) + line_name = (line.product_id.name if line.product_id.name else '') + ' ' + \ + ('(' + line.product_id.product_template_attribute_value_ids.name + ')' if line.product_id.product_template_attribute_value_ids.name else '') + ' ' + \ + (line.product_id.short_spesification if line.product_id.short_spesification else '') + line.name = line_name + + def compute_delivery_amt_line(self): for line in self: try: diff --git a/indoteknik_custom/models/solr/product_product.py b/indoteknik_custom/models/solr/product_product.py index c14f6b98..f09c2dfb 100644 --- a/indoteknik_custom/models/solr/product_product.py +++ b/indoteknik_custom/models/solr/product_product.py @@ -73,6 +73,8 @@ class ProductProduct(models.Model): 'attributes': [x.name for x in variant.product_template_attribute_value_ids], 'has_product_info_b': True, 'publish_b': not variant.unpublished, + 'sni_b': variant.sni, + 'tkdn_b': variant.tkdn, 'qty_sold_f': variant.qty_sold }) diff --git a/indoteknik_custom/models/solr/product_template.py b/indoteknik_custom/models/solr/product_template.py index 062f1455..920ae463 100644 --- a/indoteknik_custom/models/solr/product_template.py +++ b/indoteknik_custom/models/solr/product_template.py @@ -90,6 +90,8 @@ class ProductTemplate(models.Model): "description_t": template.website_description or '', 'has_product_info_b': True, 'publish_b': not template.unpublished, + 'sni_b': template.unpublished, + 'tkdn_b': template.unpublished, "qty_sold_f": template.qty_sold }) diff --git a/indoteknik_custom/views/product_template.xml b/indoteknik_custom/views/product_template.xml index 052a1eba..520af5c8 100755 --- a/indoteknik_custom/views/product_template.xml +++ b/indoteknik_custom/views/product_template.xml @@ -16,6 +16,7 @@ <field name="tkdn"/> </field> <field name="uom_po_id" position="after"> + <field name="short_spesification" /> <field name="unpublished" /> <field name="desc_update_solr" readonly="1" /> <field name="last_update_solr" readonly="1" /> |
