mirror of
https://github.com/frappe/erpnext.git
synced 2026-06-07 15:12:51 +00:00
Merge pull request #4163 from neilLasrado/develop
Cost Center - Income Account
This commit is contained in:
@@ -17,8 +17,7 @@ erpnext.accounts.CostCenterController = frappe.ui.form.Controller.extend({
|
|||||||
return {
|
return {
|
||||||
filters:[
|
filters:[
|
||||||
['Account', 'company', '=', me.frm.doc.company],
|
['Account', 'company', '=', me.frm.doc.company],
|
||||||
['Account', 'root_type', '=', 'Expense'],
|
['Account', 'is_group', '=', '0']
|
||||||
['Account', 'is_group', '=', '0'],
|
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -32,13 +32,13 @@ class CostCenter(NestedSet):
|
|||||||
for d in self.get('budgets'):
|
for d in self.get('budgets'):
|
||||||
if d.account:
|
if d.account:
|
||||||
account_details = frappe.db.get_value("Account", 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:
|
if account_details.is_group:
|
||||||
frappe.throw(_("Budget cannot be assigned against Group Account {0}").format(d.account))
|
frappe.throw(_("Budget cannot be assigned against Group Account {0}").format(d.account))
|
||||||
elif account_details.company != self.company:
|
elif account_details.company != self.company:
|
||||||
frappe.throw(_("Account {0} does not belongs to company {1}").format(d.account, self.company))
|
frappe.throw(_("Account {0} does not belongs to company {1}").format(d.account, self.company))
|
||||||
elif account_details.root_type != "Expense":
|
elif account_details.report_type != "Profit and Loss":
|
||||||
frappe.throw(_("Budget cannot be assigned against {0}, as it's not an Expense account")
|
frappe.throw(_("Budget cannot be assigned against {0}, as it's not an Income or Expense account")
|
||||||
.format(d.account))
|
.format(d.account))
|
||||||
|
|
||||||
if [d.account, d.fiscal_year] in check_acc_list:
|
if [d.account, d.fiscal_year] in check_acc_list:
|
||||||
|
|||||||
@@ -310,7 +310,7 @@ def get_stock_and_account_difference(account_list=None, posting_date=None):
|
|||||||
|
|
||||||
def validate_expense_against_budget(args):
|
def validate_expense_against_budget(args):
|
||||||
args = frappe._dict(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("""
|
budget = frappe.db.sql("""
|
||||||
select bd.budget_allocated, cc.distribution_id
|
select bd.budget_allocated, cc.distribution_id
|
||||||
from `tabCost Center` cc, `tabBudget Detail` bd
|
from `tabCost Center` cc, `tabBudget Detail` bd
|
||||||
|
|||||||
1
erpnext/change_log/current/cost_center.md
Normal file
1
erpnext/change_log/current/cost_center.md
Normal file
@@ -0,0 +1 @@
|
|||||||
|
- Allowed Income account to be added to Cost Center
|
||||||
@@ -702,7 +702,7 @@
|
|||||||
"ignore_user_permissions": 0,
|
"ignore_user_permissions": 0,
|
||||||
"in_filter": 0,
|
"in_filter": 0,
|
||||||
"in_list_view": 0,
|
"in_list_view": 0,
|
||||||
"label": "If Yearly Budget Exceeded",
|
"label": "If Yearly Budget Exceeded (for expense account)",
|
||||||
"no_copy": 0,
|
"no_copy": 0,
|
||||||
"oldfieldname": "yearly_bgt_flag",
|
"oldfieldname": "yearly_bgt_flag",
|
||||||
"oldfieldtype": "Select",
|
"oldfieldtype": "Select",
|
||||||
@@ -727,7 +727,7 @@
|
|||||||
"ignore_user_permissions": 0,
|
"ignore_user_permissions": 0,
|
||||||
"in_filter": 0,
|
"in_filter": 0,
|
||||||
"in_list_view": 0,
|
"in_list_view": 0,
|
||||||
"label": "If Monthly Budget Exceeded",
|
"label": "If Monthly Budget Exceeded (for expense account)",
|
||||||
"no_copy": 0,
|
"no_copy": 0,
|
||||||
"oldfieldname": "monthly_bgt_flag",
|
"oldfieldname": "monthly_bgt_flag",
|
||||||
"oldfieldtype": "Select",
|
"oldfieldtype": "Select",
|
||||||
@@ -1092,7 +1092,7 @@
|
|||||||
"is_submittable": 0,
|
"is_submittable": 0,
|
||||||
"issingle": 0,
|
"issingle": 0,
|
||||||
"istable": 0,
|
"istable": 0,
|
||||||
"modified": "2015-09-14 02:55:54.678003",
|
"modified": "2015-10-13 08:15:29.028637",
|
||||||
"modified_by": "Administrator",
|
"modified_by": "Administrator",
|
||||||
"module": "Setup",
|
"module": "Setup",
|
||||||
"name": "Company",
|
"name": "Company",
|
||||||
|
|||||||
Reference in New Issue
Block a user