From 6a8430c88e70e8ee98744f417e9829a847e0e3a7 Mon Sep 17 00:00:00 2001 From: Rohit Waghchaure Date: Thu, 12 Jun 2025 17:20:22 +0530 Subject: [PATCH] fix: float division by zero --- erpnext/stock/stock_ledger.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/erpnext/stock/stock_ledger.py b/erpnext/stock/stock_ledger.py index 248b64d134b..5e0c3552911 100644 --- a/erpnext/stock/stock_ledger.py +++ b/erpnext/stock/stock_ledger.py @@ -887,7 +887,10 @@ class update_entries_after: self.wh_data.valuation_rate ) - if sle.actual_qty < 0 and self.wh_data.qty_after_transaction != 0: + if ( + sle.actual_qty < 0 + and flt(self.wh_data.qty_after_transaction, self.flt_precision) != 0 + ): self.wh_data.valuation_rate = flt( self.wh_data.stock_value, self.currency_precision ) / flt(self.wh_data.qty_after_transaction, self.flt_precision) -- GitLab