diff options
| author | stephanchrst <stephanchrst@gmail.com> | 2022-10-14 15:49:41 +0700 |
|---|---|---|
| committer | stephanchrst <stephanchrst@gmail.com> | 2022-10-14 15:49:41 +0700 |
| commit | 589aacc782ce4a7d2cb89fca9ea2233294a21439 (patch) | |
| tree | 3a4e410c006576fd95d5b2b3278b4860a36a8953 /indoteknik_custom/models | |
| parent | 4426c0a7f19969b59ff35fa1e4f793b66c6c5d91 (diff) | |
Update purchase_order.py and purchase_order.xml
Diffstat (limited to 'indoteknik_custom/models')
| -rwxr-xr-x | indoteknik_custom/models/purchase_order.py | 23 |
1 files changed, 12 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: |
