mirror of
https://github.com/frappe/erpnext.git
synced 2026-09-17 18:45:20 +00:00
Co-authored-by: Diptanil Saha <diptanil@frappe.io>
This commit is contained in:
@@ -609,11 +609,8 @@ def check_credit_limit(customer, company, ignore_outstanding_sales_order=False,
|
|||||||
|
|
||||||
# if the current user does not have permissions to override credit limit,
|
# if the current user does not have permissions to override credit limit,
|
||||||
# prompt them to send out an email to the controller users
|
# prompt them to send out an email to the controller users
|
||||||
frappe.msgprint(
|
primary_action = (
|
||||||
message,
|
{
|
||||||
title=_("Credit Limit Crossed"),
|
|
||||||
raise_exception=1,
|
|
||||||
primary_action={
|
|
||||||
"label": "Send Email",
|
"label": "Send Email",
|
||||||
"server_action": "erpnext.selling.doctype.customer.customer.send_emails",
|
"server_action": "erpnext.selling.doctype.customer.customer.send_emails",
|
||||||
"hide_on_success": True,
|
"hide_on_success": True,
|
||||||
@@ -623,7 +620,16 @@ def check_credit_limit(customer, company, ignore_outstanding_sales_order=False,
|
|||||||
"credit_limit": credit_limit,
|
"credit_limit": credit_limit,
|
||||||
"credit_controller_users_list": credit_controller_users,
|
"credit_controller_users_list": credit_controller_users,
|
||||||
},
|
},
|
||||||
},
|
}
|
||||||
|
if frappe.has_permission("Customer", ptype="email", doc=customer)
|
||||||
|
else None
|
||||||
|
)
|
||||||
|
|
||||||
|
frappe.msgprint(
|
||||||
|
message,
|
||||||
|
title=_("Credit Limit Crossed"),
|
||||||
|
raise_exception=1,
|
||||||
|
primary_action=primary_action,
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
@@ -631,6 +637,7 @@ def check_credit_limit(customer, company, ignore_outstanding_sales_order=False,
|
|||||||
def send_emails(args):
|
def send_emails(args):
|
||||||
args = json.loads(args)
|
args = json.loads(args)
|
||||||
subject = _("Credit limit reached for customer {0}").format(args.get("customer"))
|
subject = _("Credit limit reached for customer {0}").format(args.get("customer"))
|
||||||
|
frappe.has_permission("Customer", ptype="email", doc=args.get("customer"), throw=True)
|
||||||
message = _("Credit limit has been crossed for customer {0} ({1}/{2})").format(
|
message = _("Credit limit has been crossed for customer {0} ({1}/{2})").format(
|
||||||
args.get("customer"), args.get("customer_outstanding"), args.get("credit_limit")
|
args.get("customer"), args.get("customer_outstanding"), args.get("credit_limit")
|
||||||
)
|
)
|
||||||
|
|||||||
Reference in New Issue
Block a user