From 741216d3eb726d5429b12512e3aefaebf00e094c Mon Sep 17 00:00:00 2001 From: "mergify[bot]" <37929162+mergify[bot]@users.noreply.github.com> Date: Mon, 1 Jun 2026 18:46:21 +0530 Subject: [PATCH] fix(je): preserve account on duplicate row when party row exists (backport #55180) (#55513) 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 181edb4cd6b..ae3ee00e535 100644 --- a/erpnext/accounts/doctype/journal_entry/journal_entry.js +++ b/erpnext/accounts/doctype/journal_entry/journal_entry.js @@ -378,15 +378,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) {