Merge pull request #40760 from ruthra-kumar/fix_cost_center_update_in_gain_loss_journal
fix: cost center shouldn't update debit/credit in Exc gain/loss JV
diff --git a/erpnext/accounts/doctype/journal_entry/journal_entry.js b/erpnext/accounts/doctype/journal_entry/journal_entry.js
index ed134ba..668cd3e 100644
--- a/erpnext/accounts/doctype/journal_entry/journal_entry.js
+++ b/erpnext/accounts/doctype/journal_entry/journal_entry.js
@@ -453,7 +453,10 @@
}
},
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) {