add something to massage some of the data
This commit is contained in:
parent
2f1c975e0a
commit
89bdbcfdcb
4 changed files with 121 additions and 9 deletions
|
|
@ -106,8 +106,12 @@ def get_client(client_name):
|
|||
clientData.update(map_lead_client(clientData))
|
||||
links = []
|
||||
if customer.doctype == "Customer":
|
||||
clientData["addresses"] = customer.custom_select_address or []
|
||||
clientData["contacts"] = customer.custom_add_contacts or []
|
||||
for address_link in customer.custom_select_address:
|
||||
address_doc = frappe.get_doc("Address", address_link.address_name)
|
||||
clientData["addresses"].append(address_doc.as_dict())
|
||||
for contact_link in customer.custom_add_contacts:
|
||||
contact_doc = frappe.get_doc("Contact", contact_link.contact)
|
||||
clientData["contacts"].append(contact_doc.as_dict())
|
||||
|
||||
else:
|
||||
links = frappe.get_all(
|
||||
|
|
@ -130,7 +134,7 @@ def get_client(client_name):
|
|||
clientData["contacts"].append(linked_doc.as_dict())
|
||||
elif link["link_doctype"] == "Address":
|
||||
clientData["addresses"].append(linked_doc.as_dict())
|
||||
doctypes_to_fetch_history = []
|
||||
|
||||
# TODO: Continue getting other linked docs like jobs, invoices, etc.
|
||||
print("DEBUG: Final client data prepared:", clientData)
|
||||
return build_success_response(clientData)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue