diff --git a/erpnext/accounts/doctype/cost_center/cost_center.js b/erpnext/accounts/doctype/cost_center/cost_center.js index fb649e6d1b3..e4db510cad9 100644 --- a/erpnext/accounts/doctype/cost_center/cost_center.js +++ b/erpnext/accounts/doctype/cost_center/cost_center.js @@ -17,8 +17,7 @@ erpnext.accounts.CostCenterController = frappe.ui.form.Controller.extend({ return { filters:[ ['Account', 'company', '=', me.frm.doc.company], - ['Account', 'root_type', '=', 'Expense'], - ['Account', 'is_group', '=', '0'], + ['Account', 'is_group', '=', '0'] ] } }); diff --git a/erpnext/accounts/doctype/cost_center/cost_center.py b/erpnext/accounts/doctype/cost_center/cost_center.py index 0f51a00cd6b..072bf60863a 100644 --- a/erpnext/accounts/doctype/cost_center/cost_center.py +++ b/erpnext/accounts/doctype/cost_center/cost_center.py @@ -32,13 +32,13 @@ class CostCenter(NestedSet): for d in self.get('budgets'): if d.account: account_details = frappe.db.get_value("Account", d.account, - ["is_group", "company", "root_type"], as_dict=1) + ["is_group", "company", "report_type"], as_dict=1) if account_details.is_group: frappe.throw(_("Budget cannot be assigned against Group Account {0}").format(d.account)) elif account_details.company != self.company: frappe.throw(_("Account {0} does not belongs to company {1}").format(d.account, self.company)) - elif account_details.root_type != "Expense": - frappe.throw(_("Budget cannot be assigned against {0}, as it's not an Expense account") + elif account_details.report_type != "Profit and Loss": + frappe.throw(_("Budget cannot be assigned against {0}, as it's not an Income or Expense account") .format(d.account)) if [d.account, d.fiscal_year] in check_acc_list: diff --git a/erpnext/accounts/utils.py b/erpnext/accounts/utils.py index 199769416e8..07606be1f75 100644 --- a/erpnext/accounts/utils.py +++ b/erpnext/accounts/utils.py @@ -310,7 +310,7 @@ def get_stock_and_account_difference(account_list=None, posting_date=None): def validate_expense_against_budget(args): args = frappe._dict(args) - if frappe.db.get_value("Account", {"name": args.account, "report_type": "Profit and Loss"}): + if frappe.db.get_value("Account", {"name": args.account, "root_type": "Expense"}): budget = frappe.db.sql(""" select bd.budget_allocated, cc.distribution_id from `tabCost Center` cc, `tabBudget Detail` bd