[Fix] If two po consolidated in one purchase invoice, Total Net Weight not get summed (#14230)
diff --git a/erpnext/controllers/taxes_and_totals.py b/erpnext/controllers/taxes_and_totals.py
index a4d9dae..b44f597 100644
--- a/erpnext/controllers/taxes_and_totals.py
+++ b/erpnext/controllers/taxes_and_totals.py
@@ -38,6 +38,7 @@
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 @@
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():