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>
This commit is contained in:
Deepesh Garg 2023-06-07 21:33:36 +05:30 committed by GitHub
parent 0166f69b31
commit 0108b1abe2
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -454,12 +454,12 @@ def check_credit_limit(customer, company, ignore_outstanding_sales_order=False,
customer_outstanding += flt(extra_amount) customer_outstanding += flt(extra_amount)
if credit_limit > 0 and flt(customer_outstanding) > credit_limit: if credit_limit > 0 and flt(customer_outstanding) > credit_limit:
msgprint( message = _("Credit limit has been crossed for customer {0} ({1}/{2})").format(
_("Credit limit has been crossed for customer {0} ({1}/{2})").format( customer, customer_outstanding, credit_limit
customer, customer_outstanding, credit_limit
)
) )
message += "<br><br>"
# If not authorized person raise exception # If not authorized person raise exception
credit_controller_role = frappe.db.get_single_value("Accounts Settings", "credit_controller") 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(): 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,
"<li>".join(credit_controller_users_formatted) "<li>".join(credit_controller_users_formatted)
) )
message = _( message += _(
"Please contact any of the following users to extend the credit limits for {0}: {1}" "Please contact any of the following users to extend the credit limits for {0}: {1}"
).format(customer, user_list) ).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 # prompt them to send out an email to the controller users
frappe.msgprint( frappe.msgprint(
message, message,
title="Notify", title=_("Credit Limit Crossed"),
raise_exception=1, raise_exception=1,
primary_action={ primary_action={
"label": "Send Email", "label": "Send Email",
@ -519,7 +519,6 @@ def get_customer_outstanding(
customer, company, ignore_outstanding_sales_order=False, cost_center=None customer, company, ignore_outstanding_sales_order=False, cost_center=None
): ):
# Outstanding based on GL Entries # Outstanding based on GL Entries
cond = "" cond = ""
if cost_center: if cost_center:
lft, rgt = frappe.get_cached_value("Cost Center", cost_center, ["lft", "rgt"]) lft, rgt = frappe.get_cached_value("Cost Center", cost_center, ["lft", "rgt"])