From 40240b7d96bba115eedfcf8ad7280a72dc72d823 Mon Sep 17 00:00:00 2001 From: Rushin Parikh Date: Mon, 22 Jul 2019 11:54:26 +0530 Subject: [PATCH] fix: filter reference name by cost center in journal entry account (#17948) * fix: filter reference name by cost center in journal entry account if reference_type is Sales Invoice or Purchase Invoice * Update journal_entry.js --- 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 b6c48c81b96..3dbf4d40eba 100644 --- a/erpnext/accounts/doctype/journal_entry/journal_entry.js +++ b/erpnext/accounts/doctype/journal_entry/journal_entry.js @@ -223,7 +223,10 @@ erpnext.accounts.JournalEntry = frappe.ui.form.Controller.extend({ if(in_list(["Sales Invoice", "Purchase Invoice"], jvd.reference_type)) { out.filters.push([jvd.reference_type, "outstanding_amount", "!=", 0]); - + // Filter by cost center + if(jvd.cost_center) { + out.filters.push([jvd.reference_type, "cost_center", "in", ["", jvd.cost_center]]); + } // account filter frappe.model.validate_missing(jvd, "account"); var party_account_field = jvd.reference_type==="Sales Invoice" ? "debit_to": "credit_to";