Skip to content

Commit

Permalink
fix: don't override reference exchange rate
Browse files Browse the repository at this point in the history
(cherry picked from commit eaac026)
  • Loading branch information
ruthra-kumar authored and mergify[bot] committed Mar 2, 2024
1 parent 1b5a237 commit e25ec41
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
7 changes: 6 additions & 1 deletion erpnext/accounts/doctype/payment_entry/payment_entry.py
Original file line number Diff line number Diff line change
Expand Up @@ -335,7 +335,10 @@ def set_missing_values(self):
)

def set_missing_ref_details(
self, force: bool = False, update_ref_details_only_for: list | None = None
self,
force: bool = False,
update_ref_details_only_for: list | None = None,
ref_exchange_rate: float | None = None,
) -> None:
for d in self.get("references"):
if d.allocated_amount:
Expand All @@ -347,6 +350,8 @@ def set_missing_ref_details(
ref_details = get_reference_details(
d.reference_doctype, d.reference_name, self.party_account_currency
)
if ref_exchange_rate:
ref_details.update({"exchange_rate": ref_exchange_rate})

for field, value in ref_details.items():
if d.exchange_gain_loss:
Expand Down
2 changes: 1 addition & 1 deletion erpnext/accounts/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -682,7 +682,7 @@ def update_reference_in_payment_entry(
payment_entry.setup_party_account_field()
payment_entry.set_missing_values()
if not skip_ref_details_update_for_pe:
payment_entry.set_missing_ref_details()
payment_entry.set_missing_ref_details(ref_exchange_rate=d.exchange_rate or None)
payment_entry.set_amounts()

payment_entry.make_exchange_gain_loss_journal(
Expand Down

0 comments on commit e25ec41

Please sign in to comment.