Skip to content

Commit

Permalink
fix: precision calculation causing 0.1 discrepancy (backport #44431) (#…
Browse files Browse the repository at this point in the history
…44436)

fix: precision calculation causing 0.1 discrepancy (#44431)

(cherry picked from commit 7f7564b)

Co-authored-by: rohitwaghchaure <[email protected]>
  • Loading branch information
mergify[bot] and rohitwaghchaure authored Nov 29, 2024
1 parent 0e39aa3 commit 0d41c23
Showing 1 changed file with 2 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -432,8 +432,6 @@ def set_incoming_rate_for_inward_transaction(self, row=None, save=False):
valuation_field = "rate"
child_table = "Subcontracting Receipt Item"

precision = frappe.get_precision(child_table, valuation_field) or 2

if not rate and self.voucher_detail_no and self.voucher_no:
rate = frappe.db.get_value(child_table, self.voucher_detail_no, valuation_field)

Expand All @@ -443,9 +441,9 @@ def set_incoming_rate_for_inward_transaction(self, row=None, save=False):
elif (d.incoming_rate == rate) and d.qty and d.stock_value_difference:
continue

d.incoming_rate = flt(rate, precision)
d.incoming_rate = rate
if d.qty:
d.stock_value_difference = flt(d.qty) * flt(d.incoming_rate)
d.stock_value_difference = d.qty * d.incoming_rate

if save:
d.db_set(
Expand Down

0 comments on commit 0d41c23

Please sign in to comment.