From f66b53b2c1f2855ad72500731c350bc37ccf8218 Mon Sep 17 00:00:00 2001 From: ruthra kumar Date: Fri, 29 Mar 2024 11:21:27 +0530 Subject: [PATCH] fix: cost center shouldn't update debit/credit in Exc gain/loss JV (cherry picked from commit 398d3022eff1df4d7179bf795570eab02fc0816b) --- erpnext/accounts/doctype/journal_entry/journal_entry.js | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/erpnext/accounts/doctype/journal_entry/journal_entry.js b/erpnext/accounts/doctype/journal_entry/journal_entry.js index a2f5455f2f7..cda0adc7257 100644 --- a/erpnext/accounts/doctype/journal_entry/journal_entry.js +++ b/erpnext/accounts/doctype/journal_entry/journal_entry.js @@ -428,7 +428,10 @@ frappe.ui.form.on("Journal Entry Account", { } }, cost_center: function (frm, dt, dn) { - erpnext.journal_entry.set_account_details(frm, dt, dn); + // Don't reset for Gain/Loss type journals, as it will make Debit and Credit values '0' + if (frm.doc.voucher_type != "Exchange Gain Or Loss") { + erpnext.journal_entry.set_account_details(frm, dt, dn); + } }, account: function (frm, dt, dn) {