Skip to content

Commit

Permalink
fix: make use of 'flt' to prevent really low precision exc gain/loss
Browse files Browse the repository at this point in the history
(cherry picked from commit 0aa72f8)
  • Loading branch information
ruthra-kumar authored and mergify[bot] committed Mar 2, 2024
1 parent 014d21a commit 9057bff
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion erpnext/controllers/accounts_controller.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@
from erpnext.accounts.utils import (
create_gain_loss_journal,
get_account_currency,
get_currency_precision,
get_fiscal_years,
validate_fiscal_year,
)
Expand Down Expand Up @@ -1299,10 +1300,12 @@ def make_exchange_gain_loss_journal(
# These are generated by Sales/Purchase Invoice during reconciliation and advance allocation.
# and below logic is only for such scenarios
if args:
precision = get_currency_precision()
for arg in args:
# Advance section uses `exchange_gain_loss` and reconciliation uses `difference_amount`
if (
arg.get("difference_amount", 0) != 0 or arg.get("exchange_gain_loss", 0) != 0
flt(arg.get("difference_amount", 0), precision) != 0
or flt(arg.get("exchange_gain_loss", 0), precision) != 0
) and arg.get("difference_account"):

party_account = arg.get("account")
Expand Down

0 comments on commit 9057bff

Please sign in to comment.