diff --git a/erpnext/accounts/doctype/budget/budget.py b/erpnext/accounts/doctype/budget/budget.py index e1038b6af33..ae891fb0a1f 100644 --- a/erpnext/accounts/doctype/budget/budget.py +++ b/erpnext/accounts/doctype/budget/budget.py @@ -98,13 +98,13 @@ class Budget(Document): 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) + _("Account {0} does not belong to company {1}").format(d.account, self.company) ) elif account_details.report_type != "Profit and Loss": frappe.throw( _( "Budget cannot be assigned against {0}, as its Root Type is not of Income or Expense" - ).format(self.account) + ).format(d.account) ) if d.account in account_list: diff --git a/erpnext/accounts/doctype/budget/test_budget.py b/erpnext/accounts/doctype/budget/test_budget.py index 6d256382042..6cd7aa766bc 100644 --- a/erpnext/accounts/doctype/budget/test_budget.py +++ b/erpnext/accounts/doctype/budget/test_budget.py @@ -357,6 +357,16 @@ class TestBudget(unittest.TestCase): self.assertRaises(BudgetError, jv.submit) + def test_budget_against_balance_sheet_account(self): + budget = frappe.new_doc("Budget") + budget.budget_against = "Cost Center" + budget.cost_center = "_Test Cost Center - _TC" + budget.company = "_Test Company" + budget.fiscal_year = get_fiscal_year(nowdate())[0] + budget.append("accounts", {"account": "_Test Bank - _TC", "budget_amount": 200000}) + + self.assertRaisesRegex(frappe.ValidationError, "_Test Bank - _TC", budget.insert) + def set_total_expense_zero(posting_date, budget_against_field=None, budget_against_CC=None): if budget_against_field == "project":