Skip to content

Commit

Permalink
fix: out of range for valuation_rate column in SE (backport #39687) (#…
Browse files Browse the repository at this point in the history
…39691)

fix: out of range for valuation_rate column in SE

(cherry picked from commit 1e15a3c)

Co-authored-by: s-aga-r <sagarsharma.s312@gmail.com>
  • Loading branch information
mergify[bot] and s-aga-r authored Feb 2, 2024
1 parent 8574941 commit 41e4632
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions erpnext/stock/stock_ledger.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
"""
Expand Down

0 comments on commit 41e4632

Please sign in to comment.