Merge pull request #38737 from frappe/mergify/bp/version-15-hotfix/pr-38717

fix: fetch exc rate of multi currency journals on reconciliation (backport #38717)
This commit is contained in:
ruthra kumar 2023-12-14 09:59:47 +05:30 committed by GitHub
commit 5cbe170117
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -592,6 +592,27 @@ class PaymentReconciliation(Document):
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):