refactor: cr/dr note will be on single exchange rate
diff --git a/erpnext/accounts/doctype/journal_entry/journal_entry.py b/erpnext/accounts/doctype/journal_entry/journal_entry.py
index e6b8b5d..0c23d77 100644
--- a/erpnext/accounts/doctype/journal_entry/journal_entry.py
+++ b/erpnext/accounts/doctype/journal_entry/journal_entry.py
@@ -768,18 +768,23 @@
)
):
- # Modified to include the posting date for which to retreive the exchange rate
- d.exchange_rate = get_exchange_rate(
- self.posting_date,
- d.account,
- d.account_currency,
- self.company,
- d.reference_type,
- d.reference_name,
- d.debit,
- d.credit,
- d.exchange_rate,
- )
+ ignore_exchange_rate = False
+ if self.get("flags") and self.flags.get("ignore_exchange_rate"):
+ ignore_exchange_rate = True
+
+ if not ignore_exchange_rate:
+ # Modified to include the posting date for which to retreive the exchange rate
+ d.exchange_rate = get_exchange_rate(
+ self.posting_date,
+ d.account,
+ d.account_currency,
+ self.company,
+ d.reference_type,
+ d.reference_name,
+ d.debit,
+ d.credit,
+ d.exchange_rate,
+ )
if not d.exchange_rate:
frappe.throw(_("Row {0}: Exchange Rate is mandatory").format(d.idx))
diff --git a/erpnext/accounts/doctype/payment_reconciliation/payment_reconciliation.py b/erpnext/accounts/doctype/payment_reconciliation/payment_reconciliation.py
index d574cd7..2c11ef5 100644
--- a/erpnext/accounts/doctype/payment_reconciliation/payment_reconciliation.py
+++ b/erpnext/accounts/doctype/payment_reconciliation/payment_reconciliation.py
@@ -650,6 +650,7 @@
"reference_type": inv.against_voucher_type,
"reference_name": inv.against_voucher,
"cost_center": erpnext.get_default_cost_center(company),
+ "exchange_rate": inv.exchange_rate,
},
{
"account": inv.account,
@@ -663,13 +664,13 @@
"reference_type": inv.voucher_type,
"reference_name": inv.voucher_no,
"cost_center": erpnext.get_default_cost_center(company),
+ "exchange_rate": inv.exchange_rate,
},
],
}
)
- if difference_entry := get_difference_row(inv):
- jv.append("accounts", difference_entry)
-
jv.flags.ignore_mandatory = True
+ jv.flags.ignore_exchange_rate = True
jv.submit()
+ jv.make_exchange_gain_loss_journal(args=[inv])