original_docstring: When an alias name appears to already be an email, we keep the local
          part only. A sanitizing / cleaning is also performed on the name. If
          name already exists an UserError is raised. 
docstring: When an alias name appears to already be an email, we keep the local
  part only. A sanitizing / cleaning is also performed on the name. If
  name already exists an UserError is raised.
docstring_tokens: When an alias name appears to already be an email we keep the local part only . A sanitizing / cleaning is also performed on the name . If name already exists an UserError is raised .
code: def _clean_and_check_unique(self, name):
          """When an alias name appears to already be an email, we keep the local
          part only. A sanitizing / cleaning is also performed on the name. If
          name already exists an UserError is raised. """
          sanitized_name = remove_accents(name).lower().split('@')[0]
          sanitized_name = re.sub(r'[^\w+.]+', '-', sanitized_name)
          sanitized_name = re.sub(r'^\.+|\.+$|\.+(?=\.)', '', sanitized_name)
          sanitized_name = sanitized_name.encode('ascii', errors='replace').decode()
  
          catchall_alias = self.env['ir.config_parameter'].sudo().get_param('mail.catchall.alias')
          bounce_alias = self.env['ir.config_parameter'].sudo().get_param('mail.bounce.alias')
          domain = [('alias_name', '=', sanitized_name)]
          if self:
              domain += [('id', 'not in', self.ids)]
          if sanitized_name in [catchall_alias, bounce_alias] or self.search_count(domain):
              raise UserError(_('The e-mail alias is already used. Please enter another one.'))
          return sanitized_name
code_tokens: def _clean_and_check_unique ( self , name ) : sanitized_name = remove_accents ( name ) . lower ( ) . split ( '@' ) [ 0 ] sanitized_name = re . sub ( r'[^\w+.]+' , '-' , sanitized_name ) sanitized_name = re . sub ( r'^\.+|\.+$|\.+(?=\.)' , '' , sanitized_name ) sanitized_name = sanitized_name . encode ( 'ascii' , errors = 'replace' ) . decode ( ) catchall_alias = self . env [ 'ir.config_parameter' ] . sudo ( ) . get_param ( 'mail.catchall.alias' ) bounce_alias = self . env [ 'ir.config_parameter' ] . sudo ( ) . get_param ( 'mail.bounce.alias' ) domain = [ ( 'alias_name' , '=' , sanitized_name ) ] if self : domain += [ ( 'id' , 'not in' , self . ids ) ] if sanitized_name in [ catchall_alias , bounce_alias ] or self . search_count ( domain ) : raise UserError ( _ ( 'The e-mail alias is already used. Please enter another one.' ) ) return sanitized_name
short_docstring: When an alias name appears to already be an email, we keep the local
  part only.
short_docstring_tokens: When an alias name appears to already be an email we keep the local part only .
comment: """When an alias name appears to already be an email, we keep the local
          part only. A sanitizing / cleaning is also performed on the name. If
          name already exists an UserError is raised. """