parameters: (self, partner=None, email=None, include_lost=False)
return_statement: return self.with_context(active_test=False).search(domain)
docstring: Search for leads that seem duplicated based on partner / email.
  
          :param partner : optional customer when searching duplicated
          :param email: email (possibly formatted) to search
          :param boolean include_lost: if True, search includes archived opportunities
            (still only active leads are considered). If False, search for active
            and not won leads and opportunities;
docstring_summary: Search for leads that seem duplicated based on partner / email.
docstring_tokens: Search for leads that seem duplicated based on partner / email .
function: def _get_lead_duplicates(self, partner=None, email=None, include_lost=False):
          """ Search for leads that seem duplicated based on partner / email.
  
          :param partner : optional customer when searching duplicated
          :param email: email (possibly formatted) to search
          :param boolean include_lost: if True, search includes archived opportunities
            (still only active leads are considered). If False, search for active
            and not won leads and opportunities;
          """
          if not email and not partner:
              return self.env['crm.lead']
  
          domain = []
          for normalized_email in [tools.email_normalize(email) for email in tools.email_split(email)]:
              domain.append(('email_normalized', '=', normalized_email))
          if partner:
              domain.append(('partner_id', '=', partner.id))
  
          if not domain:
              return self.env['crm.lead']
  
          domain = ['|'] * (len(domain) - 1) + domain
          if include_lost:
              domain += ['|', ('type', '=', 'opportunity'), ('active', '=', True)]
          else:
              domain += ['&', ('active', '=', True), '|', ('stage_id', '=', False), ('stage_id.is_won', '=', False)]
  
          return self.with_context(active_test=False).search(domain)
function_tokens: def _get_lead_duplicates ( self , partner = None , email = None , include_lost = False ) : if not email and not partner : return self . env [ 'crm.lead' ] domain = [ ] for normalized_email in [ tools . email_normalize ( email ) for email in tools . email_split ( email ) ] : domain . append ( ( 'email_normalized' , '=' , normalized_email ) ) if partner : domain . append ( ( 'partner_id' , '=' , partner . id ) ) if not domain : return self . env [ 'crm.lead' ] domain = [ '|' ] * ( len ( domain ) - 1 ) + domain if include_lost : domain += [ '|' , ( 'type' , '=' , 'opportunity' ) , ( 'active' , '=' , True ) ] else : domain += [ '&' , ( 'active' , '=' , True ) , '|' , ( 'stage_id' , '=' , False ) , ( 'stage_id.is_won' , '=' , False ) ] return self . with_context ( active_test = False ) . search ( domain )