From b7bc6bd75d3d51b4c23f6484ac8a99097cfa8701 Mon Sep 17 00:00:00 2001 From: Rushabh Mehta Date: Thu, 18 Aug 2016 12:50:58 +0530 Subject: [PATCH] [fix] better message for cost center, fixes #6109 --- erpnext/accounts/doctype/budget/budget.py | 10 +++++++--- erpnext/patches/v7_0/calculate_total_costing_amount.py | 1 + 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/erpnext/accounts/doctype/budget/budget.py b/erpnext/accounts/doctype/budget/budget.py index 819a63534a7..7b6cde7df17 100644 --- a/erpnext/accounts/doctype/budget/budget.py +++ b/erpnext/accounts/doctype/budget/budget.py @@ -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 = {} diff --git a/erpnext/patches/v7_0/calculate_total_costing_amount.py b/erpnext/patches/v7_0/calculate_total_costing_amount.py index 4da839f356d..11fdff9abd9 100644 --- a/erpnext/patches/v7_0/calculate_total_costing_amount.py +++ b/erpnext/patches/v7_0/calculate_total_costing_amount.py @@ -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()