summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAzka Nathan <darizkyfaz@gmail.com>2024-10-08 13:20:16 +0700
committerAzka Nathan <darizkyfaz@gmail.com>2024-10-08 13:20:16 +0700
commit8512e5777d0fbe84f73ec061ac2afb90e7a474e6 (patch)
treecd4a8cf9ce967b80a64e44f572b414cbadb22468
parent53cb341f8184c3d74434f2b2d18d1bd984b57118 (diff)
cr total weight
-rwxr-xr-xindoteknik_custom/models/sale_order.py10
1 files 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: