Merge pull request #4249 from nabinhait/cc_fix

[fix] Default cost center as per company
This commit is contained in:
Nabin Hait 2015-10-29 12:28:20 +05:30
commit 1aa6e98136

View File

@ -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