Thibault Delavallée
authored
PURPOSE Be defensive when dealing with email fields, notably when having multi-emails or email field containing an already-formatted email. SPECIFICATIONS When having multi-emails input in an email field, 'email_normalized' field is currently 'False', as they expect the field to contain a single email. This has several drawbacks * searching partners or fetching information based on emails does not work as most tool methods use 'email_normalized' which is False (see e.g. '_message_partner_info_from_emails', '_mail_find_partner_from_emails' or 'find_or_create'); * blacklist is not available as it is based on 'email_normalized'; * mass_mailing wrongly considers those emails as invalid and cancel their mail and related trace, as it tries to skip sending emails to invalid emails; Be more defensive and use first found email in case of multi-emails field. Other emails are ignored. It is already an improvement that does not break flows in stable and allow more emails to be sent. before -> email: '"Raoul" <raoul1@raoul.fr>, raoul2@raoul.fr' -> email_normalized: False after -> email: '"Raoul" <raoul1@raoul.fr>, raoul2@raoul.fr' -> email_normalized: raoul1@raoul.fr A side effect is that it helps finding back some partners, as indicated in tests where less phantom partners are created. Task-2612945 (Mail: Defensive email formatting) Part-of: odoo/odoo#74474
Name | Last commit | Last update |
---|---|---|
.. | ||
addons | ||
cli | ||
conf | ||
modules | ||
osv | ||
service | ||
tests | ||
tools | ||
upgrade | ||
__init__.py | ||
api.py | ||
exceptions.py | ||
fields.py | ||
http.py | ||
import_xml.rng | ||
loglevels.py | ||
models.py | ||
netsvc.py | ||
release.py | ||
sql_db.py |