Skip to content

Commit

Permalink
fix: fetch exc rate of multi currency journals
Browse files Browse the repository at this point in the history
(cherry picked from commit 1b3ba25)
  • Loading branch information
ruthra-kumar authored and mergify[bot] committed Dec 14, 2023
1 parent 3fabca1 commit f55b561
Showing 1 changed file with 21 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -592,6 +592,27 @@ def get_invoice_exchange_map(self, invoices, payments):

invoice_exchange_map.update(purchase_invoice_map)

journals = [
d.get("invoice_number") for d in invoices if d.get("invoice_type") == "Journal Entry"
]
journals.extend(
[d.get("reference_name") for d in payments if d.get("reference_type") == "Journal Entry"]
)
if journals:
journals = list(set(journals))
journals_map = frappe._dict(
frappe.db.get_all(
"Journal Entry Account",
filters={"parent": ("in", journals), "account": ("in", [self.receivable_payable_account])},
fields=[
"parent as `name`",
"exchange_rate",
],
as_list=1,
)
)
invoice_exchange_map.update(journals_map)

return invoice_exchange_map

def validate_allocation(self):
Expand Down

0 comments on commit f55b561

Please sign in to comment.