From 41e46326c04bc7939bc94fa57a82259ecaf5c7ee Mon Sep 17 00:00:00 2001 From: "mergify[bot]" <37929162+mergify[bot]@users.noreply.github.com> Date: Fri, 2 Feb 2024 15:24:45 +0530 Subject: [PATCH] fix: out of range for valuation_rate column in SE (backport #39687) (#39691) fix: out of range for valuation_rate column in SE (cherry picked from commit 1e15a3cc151d750f6b00a52c4a9a595436e465ba) Co-authored-by: s-aga-r --- erpnext/stock/stock_ledger.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/erpnext/stock/stock_ledger.py b/erpnext/stock/stock_ledger.py index 0a6a686d8e3..379320237e6 100644 --- a/erpnext/stock/stock_ledger.py +++ b/erpnext/stock/stock_ledger.py @@ -897,9 +897,12 @@ class update_entries_after(object): self.wh_data.stock_value = round_off_if_near_zero(self.wh_data.stock_value + doc.total_amount) - self.wh_data.qty_after_transaction += doc.total_qty + precision = doc.precision("total_qty") + self.wh_data.qty_after_transaction += flt(doc.total_qty, precision) if self.wh_data.qty_after_transaction: - self.wh_data.valuation_rate = self.wh_data.stock_value / self.wh_data.qty_after_transaction + self.wh_data.valuation_rate = flt(self.wh_data.stock_value, precision) / flt( + self.wh_data.qty_after_transaction, precision + ) def validate_negative_stock(self, sle): """