From aa5e16e68134dabd58d95bdcd47db78d6c045319 Mon Sep 17 00:00:00 2001 From: ruthra kumar Date: Fri, 15 Dec 2023 11:46:12 +0530 Subject: [PATCH] fix: validation error on reconciling PE to Journals as Invoice With the same exchange rate on Journal Entry and Payment Entry, reconcilition should not post exc gain/loss journal and should not throw validation error (cherry picked from commit 5eeb650dfd3ab4b20f49bacefc43d98cb856c3f3) --- erpnext/accounts/utils.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/erpnext/accounts/utils.py b/erpnext/accounts/utils.py index 934fafb820..a34282eef1 100644 --- a/erpnext/accounts/utils.py +++ b/erpnext/accounts/utils.py @@ -657,8 +657,10 @@ def update_reference_in_payment_entry( "total_amount": d.grand_total, "outstanding_amount": d.outstanding_amount, "allocated_amount": d.allocated_amount, - "exchange_rate": d.exchange_rate if d.exchange_gain_loss else payment_entry.get_exchange_rate(), - "exchange_gain_loss": d.exchange_gain_loss, + "exchange_rate": d.exchange_rate + if d.difference_amount is not None + else payment_entry.get_exchange_rate(), + "exchange_gain_loss": d.difference_amount, "account": d.account, }