[Fix] Budget against Projects
- Test case fixed - Either cost center or project is mandatory
This commit is contained in:
parent
1fa1fd7482
commit
5bd4d8a932
@ -34,7 +34,7 @@
|
|||||||
"read_only": 0,
|
"read_only": 0,
|
||||||
"remember_last_selected_value": 0,
|
"remember_last_selected_value": 0,
|
||||||
"report_hide": 0,
|
"report_hide": 0,
|
||||||
"reqd": 1,
|
"reqd": 0,
|
||||||
"search_index": 0,
|
"search_index": 0,
|
||||||
"set_only_once": 0,
|
"set_only_once": 0,
|
||||||
"unique": 0
|
"unique": 0
|
||||||
@ -370,7 +370,7 @@
|
|||||||
"issingle": 0,
|
"issingle": 0,
|
||||||
"istable": 0,
|
"istable": 0,
|
||||||
"max_attachments": 0,
|
"max_attachments": 0,
|
||||||
"modified": "2016-11-22 11:58:42.211690",
|
"modified": "2016-11-23 11:20:46.600912",
|
||||||
"modified_by": "Administrator",
|
"modified_by": "Administrator",
|
||||||
"module": "Accounts",
|
"module": "Accounts",
|
||||||
"name": "Budget",
|
"name": "Budget",
|
||||||
|
|||||||
@ -20,6 +20,8 @@ class Budget(Document):
|
|||||||
self.name = make_autoname(self.project + "/" + self.fiscal_year + "/.###")
|
self.name = make_autoname(self.project + "/" + self.fiscal_year + "/.###")
|
||||||
|
|
||||||
def validate(self):
|
def validate(self):
|
||||||
|
if not self.cost_center and not self.project:
|
||||||
|
frappe.throw(_("Budget should be allocated against either Cost Center or Project."))
|
||||||
if self.cost_center:
|
if self.cost_center:
|
||||||
self.validate_duplicate("cost_center")
|
self.validate_duplicate("cost_center")
|
||||||
if self.project:
|
if self.project:
|
||||||
|
|||||||
@ -5,7 +5,7 @@ from __future__ import unicode_literals
|
|||||||
|
|
||||||
import frappe
|
import frappe
|
||||||
import unittest
|
import unittest
|
||||||
from erpnext.accounts.doctype.budget.budget import get_actual_expense, BudgetError
|
from erpnext.accounts.doctype.budget.budget import get_actual_expense_for_CC, BudgetError
|
||||||
from erpnext.accounts.doctype.journal_entry.test_journal_entry import make_journal_entry
|
from erpnext.accounts.doctype.journal_entry.test_journal_entry import make_journal_entry
|
||||||
|
|
||||||
class TestBudget(unittest.TestCase):
|
class TestBudget(unittest.TestCase):
|
||||||
@ -89,7 +89,7 @@ class TestBudget(unittest.TestCase):
|
|||||||
budget.cancel()
|
budget.cancel()
|
||||||
|
|
||||||
def set_total_expense_zero(posting_date, cost_center=None):
|
def set_total_expense_zero(posting_date, cost_center=None):
|
||||||
existing_expense = get_actual_expense({
|
existing_expense = get_actual_expense_for_CC({
|
||||||
"account": "_Test Account Cost for Goods Sold - _TC",
|
"account": "_Test Account Cost for Goods Sold - _TC",
|
||||||
"cost_center": cost_center or "_Test Cost Center - _TC",
|
"cost_center": cost_center or "_Test Cost Center - _TC",
|
||||||
"monthly_end_date": posting_date,
|
"monthly_end_date": posting_date,
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user