diff options
| author | Nicolas Martinelli <nim@odoo.com> | 2017-10-09 12:59:13 +0200 |
|---|---|---|
| committer | Nicolas Martinelli <nim@odoo.com> | 2017-10-20 10:41:24 +0200 |
| commit | e414bae770208d5e3530bfb2a502092cb2dc2a0c (patch) | |
| tree | c477e7d63cae3d962a2e5a26ed82d5e372f7ccd8 /addons | |
| parent | e180a03af8b8dd26dacb7f1a8dac058542034e2d (diff) | |
[FIX] mail: company logo
- Activate multi-company, create companies A and B
- Set 2 companies on a user
When a message is sent (for example, thanks to the chatter), the
notification email always contains the logo of the same company,
whatever the company of the user or the company of the object.
This is a complement of commit 7a03f9ce93, applied to notifications.
Closes #20088
opw-772405
Diffstat (limited to 'addons')
| -rw-r--r-- | addons/mail/data/mail_data.xml | 3 | ||||
| -rw-r--r-- | addons/mail/models/res_partner.py | 7 |
2 files changed, 8 insertions, 2 deletions
diff --git a/addons/mail/data/mail_data.xml b/addons/mail/data/mail_data.xml index 4ca940fecd1..32e97f23948 100644 --- a/addons/mail/data/mail_data.xml +++ b/addons/mail/data/mail_data.xml @@ -66,6 +66,7 @@ <field name="model_id" ref="mail.model_mail_message"/> <field name="auto_delete" eval="True"/> <field name="body_html"><![CDATA[ +% set company = ctx.get('company', user.company_id) <div> % if ctx.get('has_button_access'): <div itemscope itemtype="http://schema.org/EmailMessage"> @@ -105,7 +106,7 @@ % endif </td> <td valign="center" align="right"> - <img src="/logo.png" style="padding: 0px; margin: 0px; height: auto; width: 80px;" alt="${user.company_id.name}"> + <img src="/logo.png?company=${company.id}" style="padding: 0px; margin: 0px; height: auto; width: 80px;" alt="${company.name}"> </td> </tr> <tr> diff --git a/addons/mail/models/res_partner.py b/addons/mail/models/res_partner.py index 46139dd4e65..fb6041e544a 100644 --- a/addons/mail/models/res_partner.py +++ b/addons/mail/models/res_partner.py @@ -61,7 +61,6 @@ class Partner(models.Model): website_url = 'http://%s' % user.company_id.website if not user.company_id.website.lower().startswith(('http:', 'https:')) else user.company_id.website else: website_url = False - company_name = user.company_id.name model_name = False if message.model: @@ -81,9 +80,15 @@ class Partner(models.Model): if message.res_id and message.model in self.env: record = self.env[message.model].browse(message.res_id) + company = user.company_id; + if record and hasattr(record, 'company_id'): + company = record.company_id; + company_name = company.name; + return { 'signature': signature, 'website_url': website_url, + 'company': company, 'company_name': company_name, 'model_name': model_name, 'record': record, |
