[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
This commit is contained in:
Nicolas Martinelli
2017-10-20 10:41:24 +02:00
parent e180a03af8
commit e414bae770
2 changed files with 8 additions and 2 deletions
+2 -1
View File
@@ -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>
+6 -1
View File
@@ -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,