From 1e15a3cc151d750f6b00a52c4a9a595436e465ba Mon Sep 17 00:00:00 2001 From: s-aga-r Date: Fri, 2 Feb 2024 13:07:26 +0530 Subject: [PATCH] fix: out of range for valuation_rate column in SE --- 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 45764f3ec0a5..e88b1921fad4 100644 --- a/erpnext/stock/stock_ledger.py +++ b/erpnext/stock/stock_ledger.py @@ -897,9 +897,12 @@ def calculate_valuation_for_serial_batch_bundle(self, sle): 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): """