Skip to content

Commit

Permalink
fix: use reference name while updating exc rate (#1623)
Browse files Browse the repository at this point in the history
  • Loading branch information
ruthra-kumar authored Apr 5, 2024
1 parent b95a7ae commit a24fbd0
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions hrms/overrides/employee_payment_entry.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ def set_missing_ref_details(
self,
force: bool = False,
update_ref_details_only_for: list | None = None,
ref_exchange_rate: float | None = None,
reference_exchange_details: dict | None = None,
) -> None:
for d in self.get("references"):
if d.allocated_amount:
Expand All @@ -45,8 +45,12 @@ def set_missing_ref_details(
)

# Only update exchange rate when the reference is Journal Entry
if ref_exchange_rate and d.reference_doctype == "Journal Entry":
ref_details.update({"exchange_rate": ref_exchange_rate})
if (
reference_exchange_details
and d.reference_doctype == reference_exchange_details.reference_doctype
and d.reference_name == reference_exchange_details.reference_name
):
ref_details.update({"exchange_rate": reference_exchange_details.exchange_rate})

for field, value in ref_details.items():
if d.exchange_gain_loss:
Expand Down

0 comments on commit a24fbd0

Please sign in to comment.