summaryrefslogtreecommitdiff
path: root/odoo
diff options
context:
space:
mode:
authorXavierDo <xdo@odoo.com>2019-02-19 14:30:18 +0000
committerXavier-Do <xdo@odoo.com>2019-03-28 09:34:11 +0000
commitfbafbf2230c485ea04ab03c778455bb59389c7d9 (patch)
tree1ede6ccf3db082c6c15b15dd546258bdbfc4b529 /odoo
parente1cd5bbedeac95e65d84da0b7657b8d54ecb6ce3 (diff)
[IMP] mail, test_mail, *: add new email.cc.mixin on main models
*: crm, project, maintenance, hr_recruitment When a record is created from an email, cc can be lost. This commit proposes a new mixin to keep cc on the record and allows to create partner for each of them when sending a message from the chatter. The mixin is added on the mail recors that can be created from mail.alias: document helpdesk.ticket mrp.eco quality.alert hr.applicant crm.lead project.task mail.channel maintenance.equipment Task: 1925001
Diffstat (limited to 'odoo')
-rw-r--r--odoo/tools/mail.py19
1 files changed, 10 insertions, 9 deletions
diff --git a/odoo/tools/mail.py b/odoo/tools/mail.py
index 40c9604157f..b6a743d874c 100644
--- a/odoo/tools/mail.py
+++ b/odoo/tools/mail.py
@@ -474,28 +474,29 @@ def email_send(email_from, email_to, subject, body, email_cc=None, email_bcc=Non
cr.close()
return res
-def email_split(text):
- """ Return a list of the email addresses found in ``text`` """
+def email_split_tuples(text):
+ """ Return a list of (name, email) addresse tuples found in ``text``"""
if not text:
return []
- return [addr[1] for addr in getaddresses([text])
+ return [(addr[0], addr[1]) for addr in getaddresses([text])
# getaddresses() returns '' when email parsing fails, and
# sometimes returns emails without at least '@'. The '@'
# is strictly required in RFC2822's `addr-spec`.
if addr[1]
if '@' in addr[1]]
+def email_split(text):
+ """ Return a list of the email addresses found in ``text`` """
+ if not text:
+ return []
+ return [email for (name, email) in email_split_tuples(text)]
+
def email_split_and_format(text):
""" Return a list of email addresses found in ``text``, formatted using
formataddr. """
if not text:
return []
- return [formataddr((addr[0], addr[1])) for addr in getaddresses([text])
- # getaddresses() returns '' when email parsing fails, and
- # sometimes returns emails without at least '@'. The '@'
- # is strictly required in RFC2822's `addr-spec`.
- if addr[1]
- if '@' in addr[1]]
+ return [formataddr((name, email)) for (name, email) in email_split_tuples(text)]
def email_normalize(text):
""" Sanitize and standardize email address entries.