From 8372c44262fdd0fba1cab94ca78835241c423cc4 Mon Sep 17 00:00:00 2001 From: Nabin Hait Date: Thu, 29 Oct 2015 11:50:36 +0530 Subject: [PATCH] [fix] Default cost center as per company --- erpnext/accounts/doctype/journal_entry/journal_entry.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/erpnext/accounts/doctype/journal_entry/journal_entry.py b/erpnext/accounts/doctype/journal_entry/journal_entry.py index 082652143a..a0bf0813de 100644 --- a/erpnext/accounts/doctype/journal_entry/journal_entry.py +++ b/erpnext/accounts/doctype/journal_entry/journal_entry.py @@ -699,13 +699,15 @@ def get_payment_entry_from_purchase_order(purchase_order): def get_payment_entry(doc): bank_account = get_default_bank_cash_account(doc.company, "Bank Entry") + cost_center = frappe.db.get_value("Company", doc.company, "cost_center") jv = frappe.new_doc('Journal Entry') jv.voucher_type = 'Bank Entry' jv.company = doc.company jv.fiscal_year = doc.fiscal_year - jv.append("accounts") + d1 = jv.append("accounts") + d1.cost_center = cost_center d2 = jv.append("accounts") if bank_account: @@ -715,6 +717,7 @@ def get_payment_entry(doc): d2.account_type = bank_account["account_type"] d2.exchange_rate = get_exchange_rate(bank_account["account"], bank_account["account_currency"], doc.company) + d2.cost_center = cost_center return jv