Merge pull request #39967 from rohitwaghchaure/fixed-subcontracting-pr-10107
fix: float division by zero
diff --git a/erpnext/stock/stock_ledger.py b/erpnext/stock/stock_ledger.py
index e88b192..d0815c9 100644
--- a/erpnext/stock/stock_ledger.py
+++ b/erpnext/stock/stock_ledger.py
@@ -899,7 +899,7 @@
precision = doc.precision("total_qty")
self.wh_data.qty_after_transaction += flt(doc.total_qty, precision)
- if self.wh_data.qty_after_transaction:
+ if flt(self.wh_data.qty_after_transaction, precision):
self.wh_data.valuation_rate = flt(self.wh_data.stock_value, precision) / flt(
self.wh_data.qty_after_transaction, precision
)