[FIX] purchase: wrong condition in mail template

Before checking the first element of
'partner_id.child_ids', rather check that
the partner and not the object has children,
to avoid crashes when the partner of the PO
is a company.
opw-1826359
This commit is contained in:
jem-odoo
2018-03-19 15:13:33 +00:00
parent 71f56fd2fa
commit 622b70ee3e
+2 -2
View File
@@ -15,7 +15,7 @@
<field name="lang">${object.partner_id.lang}</field>
<field name="body_html"><![CDATA[
<p>Dear
% if object.partner_id.is_company and object.child_ids:
% if object.partner_id.is_company and object.partner_id.child_ids:
${object.partner_id.child_ids[0].name}
% else :
${object.partner_id.name}
@@ -50,7 +50,7 @@ from ${object.company_id.name}.
<field name="report_name">PO_${(object.name or '').replace('/','_')}</field>
<field name="lang">${object.partner_id.lang}</field>
<field name="body_html"><![CDATA[
<p>Dear ${object.partner_id.name}
<p>Dear ${object.partner_id.name}
% if object.partner_id.parent_id:
(<i>${object.partner_id.parent_id.name}</i>)
% endif