diff options
| author | len-odoo <len@odoo.com> | 2018-05-30 14:06:54 +0200 |
|---|---|---|
| committer | len-odoo <35492570+len-odoo@users.noreply.github.com> | 2018-06-01 13:06:09 +0200 |
| commit | 42aff92a4e1cb35af3ee90817dccc3548761d4a8 (patch) | |
| tree | e05610d59bb196015fae05a3aac184bb65e22358 /addons | |
| parent | a5ccc1b6b528d3daa2a8ae9933466803b0dbf597 (diff) | |
[FIX] account, purchase, sale: properly quote the name of the email sender
formataddr (from the email python library) writes email_from as '"name" <email>'
in the email_from field of the mail.compose.message record.
When the mail is rendered, onchange_template_id is triggered.
This then overwrites the values of email_from among other fields.
What happens is that it uses the email_from field from the template to render
the email_from, bypassing what was put by formataddr before.
What happens in some cases is that it is rendered as 'name <email>'
(note the quotes have been stripped away).
If name contains arbitrary symbols, e.g. name = 'pépé [company] <pdg>, ohlala',
then getaddresses which is supposed to parse the (name, email) pairs gets thrown
off (in particular, <pdg> will be interpreted as an email address, and many
other problems with the various special symbols).
It then gives these wrong elements as email addresses, which will usually crash
when getting non-ascii symbols (i.e. these strings don't respect the relevant
RFC for email addresses).
Closes:
https://github.com/odoo/odoo/issues/23502
https://github.com/odoo/odoo/pull/2311823118
opw 815202
opw 1824243
Diffstat (limited to 'addons')
| -rw-r--r-- | addons/account/data/mail_template_data.xml | 2 | ||||
| -rw-r--r-- | addons/purchase/data/mail_template_data.xml | 4 | ||||
| -rw-r--r-- | addons/sale/data/mail_template_data.xml | 2 |
3 files changed, 4 insertions, 4 deletions
diff --git a/addons/account/data/mail_template_data.xml b/addons/account/data/mail_template_data.xml index 25d54c81c85..944115b47c1 100644 --- a/addons/account/data/mail_template_data.xml +++ b/addons/account/data/mail_template_data.xml @@ -7,7 +7,7 @@ <!--Email template --> <record id="email_template_edi_invoice" model="mail.template"> <field name="name">Invoicing: Invoice email</field> - <field name="email_from">${(object.user_id.email and '%s <%s>' % (object.user_id.name, object.user_id.email) or '')|safe}</field> + <field name="email_from">${(object.user_id.email and '"%s" <%s>' % (object.user_id.name, object.user_id.email) or '')|safe}</field> <field name="subject">${object.company_id.name} Invoice (Ref ${object.number or 'n/a'})</field> <field name="partner_to">${object.partner_id.id}</field> <field name="model_id" ref="account.model_account_invoice"/> diff --git a/addons/purchase/data/mail_template_data.xml b/addons/purchase/data/mail_template_data.xml index aa2f852a9ac..ceb19ec9763 100644 --- a/addons/purchase/data/mail_template_data.xml +++ b/addons/purchase/data/mail_template_data.xml @@ -5,7 +5,7 @@ <!--Email template --> <record id="email_template_edi_purchase" model="mail.template"> <field name="name">RFQ - Send by Email</field> - <field name="email_from">${(object.create_uid.email and '%s <%s>' % (object.create_uid.name, object.create_uid.email) or '')|safe}</field> + <field name="email_from">${(object.create_uid.email and '"%s" <%s>' % (object.create_uid.name, object.create_uid.email) or '')|safe}</field> <field name="subject">${object.company_id.name} Order (Ref ${object.name or 'n/a' })</field> <field name="partner_to">${object.partner_id.id}</field> <field name="model_id" ref="purchase.model_purchase_order"/> @@ -46,7 +46,7 @@ from ${object.company_id.name}. <!--Email template --> <record id="email_template_edi_purchase_done" model="mail.template"> <field name="name">Purchase Order - Send by Email</field> - <field name="email_from">${(object.create_uid.email and '%s <%s>' % (object.create_uid.name, object.create_uid.email) or '')|safe}</field> + <field name="email_from">${(object.create_uid.email and '"%s" <%s>' % (object.create_uid.name, object.create_uid.email) or '')|safe}</field> <field name="subject">${object.company_id.name} Order (Ref ${object.name or 'n/a' })</field> <field name="partner_to">${object.partner_id.id}</field> <field name="model_id" ref="purchase.model_purchase_order"/> diff --git a/addons/sale/data/mail_template_data.xml b/addons/sale/data/mail_template_data.xml index 1a584b765f5..5e46baeec0f 100644 --- a/addons/sale/data/mail_template_data.xml +++ b/addons/sale/data/mail_template_data.xml @@ -5,7 +5,7 @@ <!--Email template --> <record id="email_template_edi_sale" model="mail.template"> <field name="name">Sales Order - Send by Email</field> - <field name="email_from">${(object.user_id.email and '%s <%s>' % (object.user_id.name, object.user_id.email) or '')|safe}</field> + <field name="email_from">${(object.user_id.email and '"%s" <%s>' % (object.user_id.name, object.user_id.email) or '')|safe}</field> <field name="subject">${object.company_id.name} ${object.state in ('draft', 'sent') and 'Quotation' or 'Order'} (Ref ${object.name or 'n/a' })</field> <field name="partner_to">${object.partner_id.id}</field> <field name="model_id" ref="sale.model_sale_order"/> |
