refactor: change server_action args (#39756)

args are now flat, no need to accept them as dict

ref: https://github.com/frappe/frappe/pull/24782
This commit is contained in:
Ankush Menat 2024-02-06 13:34:28 +05:30 committed by GitHub
parent e38b46300c
commit 798a0510e6
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -572,15 +572,14 @@ def check_credit_limit(customer, company, ignore_outstanding_sales_order=False,
@frappe.whitelist()
def send_emails(args):
args = json.loads(args)
subject = _("Credit limit reached for customer {0}").format(args.get("customer"))
def send_emails(customer, customer_outstanding, credit_limit, credit_controller_users_list):
if isinstance(credit_controller_users_list, str):
credit_controller_users_list = json.loads(credit_controller_users_list)
subject = _("Credit limit reached for customer {0}").format(customer)
message = _("Credit limit has been crossed for customer {0} ({1}/{2})").format(
args.get("customer"), args.get("customer_outstanding"), args.get("credit_limit")
)
frappe.sendmail(
recipients=args.get("credit_controller_users_list"), subject=subject, message=message
customer, customer_outstanding, credit_limit
)
frappe.sendmail(recipients=credit_controller_users_list, subject=subject, message=message)
def get_customer_outstanding(