Skip to content

Commit

Permalink
Merge pull request #39687 from s-aga-r/FIX-9316
Browse files Browse the repository at this point in the history
fix: out of range for valuation_rate column in SE
  • Loading branch information
s-aga-r committed Feb 2, 2024
2 parents 12affa7 + 1e15a3c commit 2693fcb
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 2693fcb

Please sign in to comment.