Skip to content

Commit

Permalink
Merge pull request #36942 from frappe/mergify/bp/version-14-hotfix/pr…
Browse files Browse the repository at this point in the history
…-36940

fix: invalid gain/loss JE created on base currency Expense Claim (backport #36940)
  • Loading branch information
ruthra-kumar authored Sep 4, 2023
2 parents fca154f + 068f1b5 commit 2d2bcd3
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions erpnext/accounts/doctype/payment_entry/payment_entry.py
Original file line number Diff line number Diff line change
Expand Up @@ -809,6 +809,11 @@ def calculate_base_allocated_amount_for_reference(self, d) -> float:
flt(d.allocated_amount) * flt(exchange_rate), self.precision("base_paid_amount")
)

# on rare case, when `exchange_rate` is unset, gain/loss amount is incorrectly calculated
# for base currency transactions
if d.exchange_rate is None:
d.exchange_rate = 1

allocated_amount_in_pe_exchange_rate = flt(
flt(d.allocated_amount) * flt(d.exchange_rate), self.precision("base_paid_amount")
)
Expand Down

0 comments on commit 2d2bcd3

Please sign in to comment.