From 8512e5777d0fbe84f73ec061ac2afb90e7a474e6 Mon Sep 17 00:00:00 2001 From: Azka Nathan Date: Tue, 8 Oct 2024 13:20:16 +0700 Subject: cr total weight --- indoteknik_custom/models/sale_order.py | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/indoteknik_custom/models/sale_order.py b/indoteknik_custom/models/sale_order.py index d56a7946..c1c2c267 100755 --- a/indoteknik_custom/models/sale_order.py +++ b/indoteknik_custom/models/sale_order.py @@ -138,8 +138,14 @@ class SaleOrder(models.Model): total_weight = fields.Float(string='Total Weight', compute='_compute_total_weight') def _compute_total_weight(self): - for order in self: - order.total_weight = sum(line.weight for line in order.order_line) + total_weight = 0 + missing_weight_products = [] + + for line in self.order_line: + if line.weight: + total_weight += line.weight * line.product_uom_qty + + self.total_weight = total_weight def action_indoteknik_estimate_shipping(self): if not self.real_shipping_id.kota_id.is_jabodetabek: -- cgit v1.2.3