update to make customer to bill primary

This commit is contained in:
Casey Wittrock 2025-11-12 07:06:43 -06:00
parent 3b86ed0ee7
commit 19369cd21f

View File

@ -136,12 +136,11 @@ def get_clients_table_data(filters = {}, sorting = [], page=1, page_size=10):
rows = []
for address in addresses:
print("DEBUG: Processing address:", address)
links = address.links
print("DEBUG: Address links:", links)
customer_links = [link for link in links if link.link_doctype == "Customer"] if links else None
print("DEBUG: Extracted customer links:", customer_links)
customer_name = customer_links[0].link_name if customer_links else address["custom_customer_to_bill"]
customer_name = address["custom_customer_to_bill"] if address.get("custom_customer_to_bill") else (customer_links[0].link_name if customer_links else "N/A")
tableRow = {}
tableRow["id"] = address["name"]
tableRow["customer_name"] = customer_name