diff --git a/crm/fcrm/doctype/crm_deal/api.py b/crm/fcrm/doctype/crm_deal/api.py index 26a88ca6..9b5ee368 100644 --- a/crm/fcrm/doctype/crm_deal/api.py +++ b/crm/fcrm/doctype/crm_deal/api.py @@ -20,9 +20,13 @@ def get_deal_contacts(name): "CRM Contacts", filters={"parenttype": "CRM Deal", "parent": name}, fields=["contact", "is_primary"], + distinct=True, ) deal_contacts = [] for contact in contacts: + if not contact.contact: + continue + is_primary = contact.is_primary contact = frappe.get_doc("Contact", contact.contact).as_dict()