From 589aacc782ce4a7d2cb89fca9ea2233294a21439 Mon Sep 17 00:00:00 2001 From: stephanchrst Date: Fri, 14 Oct 2022 15:49:41 +0700 Subject: Update purchase_order.py and purchase_order.xml --- indoteknik_custom/models/purchase_order.py | 23 ++++++++++++----------- indoteknik_custom/views/purchase_order.xml | 4 ++++ 2 files changed, 16 insertions(+), 11 deletions(-) diff --git a/indoteknik_custom/models/purchase_order.py b/indoteknik_custom/models/purchase_order.py index 8736a6f4..84a95f9a 100755 --- a/indoteknik_custom/models/purchase_order.py +++ b/indoteknik_custom/models/purchase_order.py @@ -34,8 +34,9 @@ class PurchaseOrder(models.Model): 'SO Margin%', compute='compute_total_margin', help="Total % Margin in Sales Order Header") amount_total_without_service = fields.Float('AmtTotalWithoutService', compute='compute_amt_total_without_service') - summary_qty_po = fields.Float('Summary Qty PO', compute='_compute_summary_qty') + summary_qty_po = fields.Float('Total Qty', compute='_compute_summary_qty') summary_qty_receipt = fields.Float('Summary Qty Receipt', compute='_compute_summary_qty') + count_line_product = fields.Float('Total Item', compute='compute_count_line_product') def calculate_po_status_beginning(self): purchases = self.env['purchase.order'].search([ @@ -122,16 +123,16 @@ class PurchaseOrder(models.Model): } self.env['purchase.order.line'].sudo().create(values) - # def compute_count_line_product(self): - # for order in self: - # count = 0 - # for line in order.order_line: - # if line.product_id.type == 'product': - # count += 1 - # if count == 0: - # order.count_line_product = 1 - # else: - # order.count_line_product = count + def compute_count_line_product(self): + for order in self: + count = 0 + for line in order.order_line: + if line.product_id.type == 'product': + count += 1 + if count == 0: + order.count_line_product = 1 + else: + order.count_line_product = count def compute_delivery_amount(self): for order in self: diff --git a/indoteknik_custom/views/purchase_order.xml b/indoteknik_custom/views/purchase_order.xml index 41e97cd9..31524d65 100755 --- a/indoteknik_custom/views/purchase_order.xml +++ b/indoteknik_custom/views/purchase_order.xml @@ -24,6 +24,10 @@ + + + + -- cgit v1.2.3