diff --git a/crm/api/session.py b/crm/api/session.py index 2af88328..c6218317 100644 --- a/crm/api/session.py +++ b/crm/api/session.py @@ -79,6 +79,7 @@ def get_lead_contacts(): "image", "modified" ], + filters={"converted": 0}, order_by="lead_name asc", distinct=True, ) diff --git a/crm/integrations/twilio/twilio_handler.py b/crm/integrations/twilio/twilio_handler.py index 30eba885..4f03a4ab 100644 --- a/crm/integrations/twilio/twilio_handler.py +++ b/crm/integrations/twilio/twilio_handler.py @@ -199,7 +199,7 @@ def get_the_call_attender(owners, caller=None): if len(current_loggedin_users) > 1 and caller: deal_owner = frappe.db.get_value('CRM Deal', {'mobile_no': caller}, 'deal_owner') if not deal_owner: - deal_owner = frappe.db.get_value('CRM Lead', {'mobile_no': caller}, 'lead_owner') + deal_owner = frappe.db.get_value('CRM Lead', {'mobile_no': caller, 'converted': False}, 'lead_owner') for user in current_loggedin_users: if user == deal_owner: current_loggedin_users = [user]