From fe585dc225d65c191dfab16b7f9e0341983a1384 Mon Sep 17 00:00:00 2001 From: "mergify[bot]" <37929162+mergify[bot]@users.noreply.github.com> Date: Mon, 1 Jun 2026 18:46:07 +0530 Subject: [PATCH] fix(je): preserve account on duplicate row when party row exists (backport #55180) (#55512) fix(je): preserve account on duplicate row when party row exists (#55180) (cherry picked from commit 57dbac712f8345bd083184a731632db92b6b6568) Co-authored-by: Gajendra Nishad <75714258+gajjug004@users.noreply.github.com> --- .../doctype/journal_entry/journal_entry.js | 20 ++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) diff --git a/erpnext/accounts/doctype/journal_entry/journal_entry.js b/erpnext/accounts/doctype/journal_entry/journal_entry.js index 62799ab820d..b1dc0c477b7 100644 --- a/erpnext/accounts/doctype/journal_entry/journal_entry.js +++ b/erpnext/accounts/doctype/journal_entry/journal_entry.js @@ -433,15 +433,17 @@ erpnext.accounts.JournalEntry = class JournalEntry extends frappe.ui.form.Contro accounts_add(doc, cdt, cdn) { var row = frappe.get_doc(cdt, cdn); - row.exchange_rate = 1; - $.each(doc.accounts, function (i, d) { - if (d.account && d.party && d.party_type) { - row.account = d.account; - row.party = d.party; - row.party_type = d.party_type; - row.exchange_rate = d.exchange_rate; - } - }); + if (!row.exchange_rate) row.exchange_rate = 1; + if (!row.account) { + $.each(doc.accounts, function (i, d) { + if (d.account && d.party && d.party_type) { + row.account = d.account; + row.party = d.party; + row.party_type = d.party_type; + row.exchange_rate = d.exchange_rate; + } + }); + } // set difference if (doc.difference) {