[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
This commit is contained in:
@@ -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>
|
||||
|
||||
@@ -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>
|
||||
|
||||
@@ -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>
|
||||
|
||||
Reference in New Issue
Block a user