'Search for opportunities that have the same partner and that arent done or cancelled'

@api.model
def _get_duplicated_leads_by_emails(self, partner_id, email, include_lost=False):

    partner_match_domain = []
    for email in set((email_split(email) + [email])):
        partner_match_domain.append(('email_from', '=ilike', email))
    if partner_id:
        partner_match_domain.append(('partner_id', '=', partner_id))
    partner_match_domain = ((['|'] * (len(partner_match_domain) - 1)) + partner_match_domain)
    if (not partner_match_domain):
        return []
    domain = partner_match_domain
    if (not include_lost):
        domain += ['&', ('active', '=', True), ('probability', '<', 100)]
    return self.search(domain)
