[fix] better message for cost center, fixes #6109
This commit is contained in:
parent
b969c2cb60
commit
b7bc6bd75d
@ -5,7 +5,7 @@
|
||||
from __future__ import unicode_literals
|
||||
import frappe
|
||||
from frappe import _
|
||||
from frappe.utils import flt, getdate, add_months, get_last_day
|
||||
from frappe.utils import flt, getdate, add_months, get_last_day, fmt_money
|
||||
from frappe.model.naming import make_autoname
|
||||
from frappe.model.document import Document
|
||||
|
||||
@ -85,13 +85,17 @@ def compare_expense_with_budget(args, cost_center, budget_amount, action_for, ac
|
||||
actual_expense = get_actual_expense(args, cost_center)
|
||||
if actual_expense > budget_amount:
|
||||
diff = actual_expense - budget_amount
|
||||
currency = frappe.db.get_value('Company', frappe.db.get_value('Cost Center',
|
||||
cost_center, 'company'), 'default_currency')
|
||||
|
||||
msg = _("{0} Budget for Account {1} against Cost Center {2} is {3}. It will exceed by {4}").format(_(action_for), args.account, cost_center, budget_amount, diff)
|
||||
msg = _("{0} Budget for Account {1} against Cost Center {2} is {3}. It will exceed by {4}").format(_(action_for),
|
||||
frappe.bold(args.account), frappe.bold(cost_center),
|
||||
frappe.bold(fmt_money(budget_amount, currency=currency)), frappe.bold(fmt_money(diff, currency=currency)))
|
||||
|
||||
if action=="Stop":
|
||||
frappe.throw(msg, BudgetError)
|
||||
else:
|
||||
frappe.msgprint(msg)
|
||||
frappe.msgprint(msg, indicator='orange')
|
||||
|
||||
def get_accumulated_monthly_budget(monthly_distribution, posting_date, fiscal_year, annual_budget):
|
||||
distribution = {}
|
||||
|
@ -13,4 +13,5 @@ def execute():
|
||||
ts.flags.ignore_validate = True
|
||||
ts.flags.ignore_mandatory = True
|
||||
ts.flags.ignore_validate_update_after_submit = True
|
||||
ts.flags.ignore_links = True
|
||||
ts.save()
|
||||
|
Loading…
x
Reference in New Issue
Block a user