From ff7390468fb11915b35c9f522379132dde19a54d Mon Sep 17 00:00:00 2001 From: stephanchrst Date: Wed, 28 Jun 2023 12:29:12 +0700 Subject: bug fix vendor subtotal --- indoteknik_custom/models/sale_order.py | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/indoteknik_custom/models/sale_order.py b/indoteknik_custom/models/sale_order.py index 3b3ce13a..5f37e3b2 100755 --- a/indoteknik_custom/models/sale_order.py +++ b/indoteknik_custom/models/sale_order.py @@ -470,13 +470,11 @@ class SaleOrderLine(models.Model): fee_third_party_line = fields.Float('FeeThirdPartyLine', compute='compute_fee_third_party_line', default=0) line_no = fields.Integer('No', default=0, copy=False) note_procurement = fields.Char(string='Note', help="Harap diisi jika ada keterangan tambahan dari Procurement, agar dapat dimonitoring") - vendor_subtotal = fields.Float( - string='Vendor Subtotal', compute="compute_vendor_subtotal") + vendor_subtotal = fields.Float(string='Vendor Subtotal', compute="_compute_vendor_subtotal") - def compute_vendor_subtotal(self): - # self.vendor_subtotal = 1 + def _compute_vendor_subtotal(self): for line in self: - if line.purchase_price > 0: + if line.purchase_price > 0 and line.product_uom_qty > 0: # product = line.product_id # if product: @@ -485,8 +483,10 @@ class SaleOrderLine(models.Model): # vendor_price = line.purchase_price # else: # vendor_price = line.purchase_price + (line.purchase_price*11/100) - - line.vendor_subtotal = line.purchase_price * line.product_uom_qty + subtotal = line.purchase_price * line.product_uom_qty + line.vendor_subtotal = subtotal + else: + line.vendor_subtotal = 0 def compute_item_margin(self): for line in self: -- cgit v1.2.3