summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGoffin Simon <sig@odoo.com>2018-04-18 16:53:04 +0200
committerGoffin Simon <sig@odoo.com>2018-04-23 09:33:22 +0200
commit4ac10f20c45a401161fd8714c808728ff4364dc2 (patch)
tree98a6c40fee0121298fa3bc53835d84c6abd4e058
parentab95e3c1f3565f8c63cd2e1e4349f646334cf94e (diff)
[FIX] account, purchase, sale: Wrong company displayed in the footer
Steps to reproduce the bug: - Set a multi company environment with two company A and B - Set user admin in company A - Set user demo in company B - Create a PO with user demo - Send a RFQ Bug: The company of the admin user was displayed in the footer of the email. The function _notify called on res.parter model is called in sudo by the function _notify on mail.message model. The function render_template on mail.template model uses the user defined on self.env to render the template. So the user admin was always used. opw:1835647
-rw-r--r--addons/account/data/email_template_data_invoice.xml2
-rw-r--r--addons/purchase/data/mail_template_data.xml17
-rw-r--r--addons/sale/data/mail_template_data.xml2
3 files changed, 11 insertions, 10 deletions
diff --git a/addons/account/data/email_template_data_invoice.xml b/addons/account/data/email_template_data_invoice.xml
index b012e8cbbf1..7701b1ce222 100644
--- a/addons/account/data/email_template_data_invoice.xml
+++ b/addons/account/data/email_template_data_invoice.xml
@@ -70,7 +70,7 @@ from ${object.company_id.name}.
<field name="body_html"><![CDATA[<html>
<head></head>
% set record = ctx.get('record')
- % set company = record and record.company_id or user.company_id
+ % set company = record and record.company_id or ctx.get('company')
<body style="margin: 0; padding: 0;">
<table border="0" width="100%" cellpadding="0" bgcolor="#ededed" style="padding: 20px; background-color: #ededed; border-collapse:separate;" summary="o_mail_notification">
<tbody>
diff --git a/addons/purchase/data/mail_template_data.xml b/addons/purchase/data/mail_template_data.xml
index 35445697973..626da70daa9 100644
--- a/addons/purchase/data/mail_template_data.xml
+++ b/addons/purchase/data/mail_template_data.xml
@@ -86,6 +86,7 @@ from ${object.company_id.name}.
<field name="auto_delete" eval="True"/>
<field name="body_html"><![CDATA[<html>
<head></head>
+ % set company = record and record.company_id or ctx.get('company')
<body style="margin: 0; padding: 0;">
<table border="0" width="100%" cellpadding="0" bgcolor="#ededed" style="padding: 20px; background-color: #ededed" summary="o_mail_notification">
<tbody>
@@ -101,7 +102,7 @@ from ${object.company_id.name}.
</span>
</td>
<td valign="middle" align="right">
- <img src="/logo.png" style="padding: 0px; margin: 0px; height: auto; width: 80px;" alt="${user.company_id.name}">
+ <img src="/logo.png" style="padding: 0px; margin: 0px; height: auto; width: 80px;" alt="${company.name}">
</td>
</tr>
</table>
@@ -127,16 +128,16 @@ from ${object.company_id.name}.
<table width="590" border="0" cellpadding="0" bgcolor="#875A7B" style="min-width: 590px; background-color: rgb(135,90,123); padding: 20px;">
<tr>
<td valign="middle" align="left" style="color: #fff; padding-top: 10px; padding-bottom: 10px; font-size: 12px;">
- ${user.company_id.name}<br/>
- ${user.company_id.phone or ''}
+ ${company.name}<br/>
+ ${company.phone or ''}
</td>
<td valign="middle" align="right" style="color: #fff; padding-top: 10px; padding-bottom: 10px; font-size: 12px;">
- % if user.company_id.email:
- <a href="mailto:${user.company_id.email}" style="text-decoration:none; color: white;">${user.company_id.email}</a><br/>
+ % if company.email:
+ <a href="mailto:${company.email}" style="text-decoration:none; color: white;">${company.email}</a><br/>
% endif
- % if user.company_id.website:
- <a href="${user.company_id.website}" style="text-decoration:none; color: white;">
- ${user.company_id.website}
+ % if company.website:
+ <a href="${company.website}" style="text-decoration:none; color: white;">
+ ${company.website}
</a>
% endif
</td>
diff --git a/addons/sale/data/mail_template_data.xml b/addons/sale/data/mail_template_data.xml
index acae4ff8cc1..79e796b2c73 100644
--- a/addons/sale/data/mail_template_data.xml
+++ b/addons/sale/data/mail_template_data.xml
@@ -69,7 +69,7 @@ from ${object.company_id.name}.
<field name="body_html"><![CDATA[<html>
<head></head>
% set record = ctx.get('record')
- % set company = record and record.company_id or user.company_id
+ % set company = record and record.company_id or ctx.get('company')
<body style="margin: 0; padding: 0;">
<table border="0" width="100%" cellpadding="0" bgcolor="#ededed" style="padding: 20px; background-color: #ededed; border-collapse:separate;" summary="o_mail_notification">
<tbody>