Skip to content

Commit

Permalink
fix: invalid gain/loss JE created on base currency Expense Claim
Browse files Browse the repository at this point in the history
(cherry picked from commit 75d95ac)
  • Loading branch information
ruthra-kumar authored and mergify[bot] committed Sep 4, 2023
1 parent fca154f commit 068f1b5
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 068f1b5

Please sign in to comment.