fix:add exception for no opportunity
diff --git a/erpnext/crm/doctype/appointment/appointment.py b/erpnext/crm/doctype/appointment/appointment.py
index 714e88d..2b9d31d 100644
--- a/erpnext/crm/doctype/appointment/appointment.py
+++ b/erpnext/crm/doctype/appointment/appointment.py
@@ -142,6 +142,8 @@
'party_name': self.lead,
},
order_by='creation desc')
+ if not opporutnities:
+ return None
latest_opportunity = frappe.get_doc(
'Opportunity', opporutnities[0].name)
assignee = latest_opportunity._assign