@ -34,8 +34,9 @@ class email_exact(base):
mailaddresses = [ ]
mailaddresses = [ ]
fields = conf . mail_field . split ( ' , ' )
fields = conf . mail_field . split ( ' , ' )
for field in fields :
for field in fields :
if field in mail_message :
mailaddresses + = to_email ( mail_message [ field ] )
mailaddresses + = to_email ( mail_message [ field ] )
return mailaddresses
return [ addr . lower ( ) for addr in mailaddresses ]
def _get_mailaddress_search_domain (
def _get_mailaddress_search_domain (
self , conf , mail_message , operator = ' = ' , values = None ) :
self , conf , mail_message , operator = ' = ' , values = None ) :
@ -43,12 +44,13 @@ class email_exact(base):
conf , mail_message )
conf , mail_message )
if not mailaddresses :
if not mailaddresses :
return [ ( 0 , ' = ' , 1 ) ]
return [ ( 0 , ' = ' , 1 ) ]
return ( ( [ ' | ' ] * ( len ( mailaddresses ) - 1 ) ) + [
search_domain = ( ( [ ' | ' ] * ( len ( mailaddresses ) - 1 ) ) + [
( conf . model_field , operator , addr ) for addr in mailaddresses ] +
( conf . model_field , operator , addr ) for addr in mailaddresses ] +
safe_eval ( conf . domain or ' [] ' ) )
safe_eval ( conf . domain or ' [] ' ) )
return search_domain
def search_matches ( self , cr , uid , conf , mail_message , mail_message_org ) :
def search_matches ( self , cr , uid , conf , mail_message , mail_message_org ) :
return conf . pool . get ( conf . model_id . model ) . search (
cr , uid ,
self . _get_mailaddress_search_domain ( conf , mail_message ) ,
order = conf . model_order )
conf_model = conf . pool . get ( conf . model_id . model )
search_domain = self . _get_mailaddress_search_domain ( conf , mail_message )
return conf_model . search (
cr , uid , search_domain , order = conf . model_order )