[IMP] mail_mail: cleaned code about reply_to format: now uses tools.email_split, cleaned a bit the code.
bzr revid: tde@openerp.com-20130313111926-45d9gct5nihr6f6n
This commit is contained in:
parent
d49889c9a8
commit
6b2c64ff40
|
@ -209,17 +209,15 @@ class mail_mail(osv.Model):
|
||||||
email_reply_to = self.pool.get(mail.model).message_get_reply_to(cr, uid, [mail.res_id], context=context)[0]
|
email_reply_to = self.pool.get(mail.model).message_get_reply_to(cr, uid, [mail.res_id], context=context)[0]
|
||||||
# no alias reply_to -> reply_to will be the email_from, only the email part
|
# no alias reply_to -> reply_to will be the email_from, only the email part
|
||||||
if not email_reply_to and mail.email_from:
|
if not email_reply_to and mail.email_from:
|
||||||
match = re.search(r'([^\s,<@]+@[^>\s,]+)', mail.email_from) # TDE TODO: simplify multiple same regex
|
emails = tools.email_split(mail.email_from)
|
||||||
if match:
|
if emails:
|
||||||
email_reply_to = match.group(1)
|
email_reply_to = emails[0]
|
||||||
|
|
||||||
# format 'Document name <email_address>'
|
# format 'Document name <email_address>'
|
||||||
if email_reply_to:
|
if email_reply_to and mail.model and mail.res_id:
|
||||||
document_name = ''
|
document_name = self.pool.get(mail.model).name_get(cr, SUPERUSER_ID, [mail.res_id], context=context)[0]
|
||||||
if mail.model and mail.res_id:
|
|
||||||
document_name = self.pool.get(mail.model).name_get(cr, SUPERUSER_ID, [mail.res_id], context=context)[0]
|
|
||||||
if document_name:
|
if document_name:
|
||||||
email_reply_to = 'Followers of %s <%s>' % (document_name[1], email_reply_to)
|
email_reply_to = _('Followers of %s <%s>') % (document_name[1], email_reply_to)
|
||||||
|
|
||||||
return email_reply_to
|
return email_reply_to
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue