From e414bae770208d5e3530bfb2a502092cb2dc2a0c Mon Sep 17 00:00:00 2001 From: Nicolas Martinelli Date: Mon, 9 Oct 2017 12:59:13 +0200 Subject: [PATCH] [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 --- addons/mail/data/mail_data.xml | 3 ++- 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 @@ % if ctx.get('has_button_access'):
@@ -105,7 +106,7 @@ % endif - ${user.company_id.name} + ${company.name} 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,