From a8fb2db001f282b78168b82d97bf94ca7e4aafc7 Mon Sep 17 00:00:00 2001 From: rohitwaghchaure Date: Sat, 26 May 2018 09:23:02 +0530 Subject: [PATCH] [Fix] If two po consolidated in one purchase invoice, Total Net Weight not get summed (#14230) --- erpnext/controllers/taxes_and_totals.py | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/erpnext/controllers/taxes_and_totals.py b/erpnext/controllers/taxes_and_totals.py index a4d9daedd6..b44f597ed7 100644 --- a/erpnext/controllers/taxes_and_totals.py +++ b/erpnext/controllers/taxes_and_totals.py @@ -38,6 +38,7 @@ class calculate_taxes_and_totals(object): self.manipulate_grand_total_for_inclusive_tax() self.calculate_totals() self._cleanup() + self.calculate_total_net_weight() def validate_conversion_rate(self): # validate conversion rate @@ -328,6 +329,13 @@ class calculate_taxes_and_totals(object): self.set_rounded_total() + def calculate_total_net_weight(self): + if self.doc.meta.get_field('total_net_weight'): + self.doc.total_net_weight = 0.0 + for d in self.doc.items: + if d.total_weight: + self.doc.total_net_weight += d.total_weight + def set_rounded_total(self): if self.doc.meta.get_field("rounded_total"): if self.doc.is_rounded_total_disabled():