[Fix] Getting an error cost center is not defined in the purchase receipt, even if it's defined in the company (#10320)

This commit is contained in:
rohitwaghchaure
2017-08-10 11:32:59 +05:30
committed by Nabin Hait
parent aac8349391
commit 2e8232e7aa
4 changed files with 107 additions and 6 deletions

View File

@@ -28,6 +28,16 @@ def get_default_currency():
if company:
return frappe.db.get_value('Company', company, 'default_currency')
def get_default_cost_center(company):
'''Returns the default cost center of the company'''
if not company:
return None
if not frappe.flags.company_cost_center:
frappe.flags.company_cost_center = {}
if not company in frappe.flags.company_cost_center:
frappe.flags.company_cost_center[company] = frappe.db.get_value('Company', company, 'cost_center')
return frappe.flags.company_cost_center[company]
def get_company_currency(company):
'''Returns the default company currency'''