From 0108b1abe256710f787a08657d80c0e58f5d38b8 Mon Sep 17 00:00:00 2001 From: Deepesh Garg Date: Wed, 7 Jun 2023 21:33:36 +0530 Subject: [PATCH] fix: Improve validation message (#35489) * fix: Improve validation message * Update erpnext/selling/doctype/customer/customer.py Co-authored-by: Raffael Meyer <14891507+barredterra@users.noreply.github.com> --------- Co-authored-by: Raffael Meyer <14891507+barredterra@users.noreply.github.com> --- erpnext/selling/doctype/customer/customer.py | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/erpnext/selling/doctype/customer/customer.py b/erpnext/selling/doctype/customer/customer.py index f15ac1257b..6367e3cb6a 100644 --- a/erpnext/selling/doctype/customer/customer.py +++ b/erpnext/selling/doctype/customer/customer.py @@ -454,12 +454,12 @@ def check_credit_limit(customer, company, ignore_outstanding_sales_order=False, customer_outstanding += flt(extra_amount) if credit_limit > 0 and flt(customer_outstanding) > credit_limit: - msgprint( - _("Credit limit has been crossed for customer {0} ({1}/{2})").format( - customer, customer_outstanding, credit_limit - ) + message = _("Credit limit has been crossed for customer {0} ({1}/{2})").format( + customer, customer_outstanding, credit_limit ) + message += "

" + # If not authorized person raise exception credit_controller_role = frappe.db.get_single_value("Accounts Settings", "credit_controller") if not credit_controller_role or credit_controller_role not in frappe.get_roles(): @@ -480,7 +480,7 @@ def check_credit_limit(customer, company, ignore_outstanding_sales_order=False, "
  • ".join(credit_controller_users_formatted) ) - message = _( + message += _( "Please contact any of the following users to extend the credit limits for {0}: {1}" ).format(customer, user_list) @@ -488,7 +488,7 @@ def check_credit_limit(customer, company, ignore_outstanding_sales_order=False, # prompt them to send out an email to the controller users frappe.msgprint( message, - title="Notify", + title=_("Credit Limit Crossed"), raise_exception=1, primary_action={ "label": "Send Email", @@ -519,7 +519,6 @@ def get_customer_outstanding( customer, company, ignore_outstanding_sales_order=False, cost_center=None ): # Outstanding based on GL Entries - cond = "" if cost_center: lft, rgt = frappe.get_cached_value("Cost Center", cost_center, ["lft", "rgt"])