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 <sagarsharma.s312@gmail.com>
This commit is contained in:
mergify[bot] 2024-02-02 15:24:45 +05:30 committed by GitHub
parent 8574941cb6
commit 41e46326c0
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -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):
"""