mirror of
https://github.com/frappe/erpnext.git
synced 2026-08-16 16:08:39 +00:00
fix: parse native JSON contacts args in CRM prospect/customer endpoints
create_prospect_against_crm_deal and create_customer read `contacts`
from form_dict (json.loads(doc.contacts) / customer_data.get("contacts")),
which arrives as a native list under JSON body mode. Use frappe.parse_json.
This commit is contained in:
@@ -33,7 +33,7 @@ def create_prospect_against_crm_deal():
|
||||
pass
|
||||
|
||||
if doc.contacts and len(doc.contacts):
|
||||
create_contacts(json.loads(doc.contacts), prospect.company_name, "Prospect", prospect_name)
|
||||
create_contacts(frappe.parse_json(doc.contacts), prospect.company_name, "Prospect", prospect_name)
|
||||
|
||||
create_address("Prospect", prospect_name, doc.address)
|
||||
frappe.response["message"] = prospect_name
|
||||
@@ -152,7 +152,7 @@ def create_customer(customer_data: dict | None = None):
|
||||
customer.insert(ignore_permissions=True)
|
||||
customer_name = customer.name
|
||||
|
||||
contacts = json.loads(customer_data.get("contacts"))
|
||||
contacts = frappe.parse_json(customer_data.get("contacts"))
|
||||
create_contacts(contacts, customer_name, "Customer", customer_name)
|
||||
create_address("Customer", customer_name, customer_data.get("address"))
|
||||
return customer_name
|
||||
|
||||
Reference in New Issue
Block a user