Hi all,
I am trying to create an email template that makes a small html table per record type, then creates a line for every record.
The current draft code is below. However, the email template doesn't show anything, not even the first html line.
Does anybody know why Odoo is not rendering or at least trying to render this block ? It seems the templates are hard to control as sometimes the code in translations is taken outside the for-block. But even when the code stays like the below nothing is rendered.
<b>Here is your overview</b><br><br>
${prevtype} = ''
% for aline in object.x_alert_line_ids:
% if ${aline.x_alert_type} != ${prevtype} :
% if ${prevtype} != '' :
</tbody></table><br><br>
%endif
<b>NEXT TYPE</b><br>
<table border="1"><tbody>
% endif
<tr>
<td>${aline.x_CPO}</td>
<td>${aline.x_customer}</td>
<td> ${aline.x_factory} </td>
<td> ${aline.x_effective_ready_date} </td>
</tr>
${prevtype} = ${aline.x_alert_type}
% endfor
Seppe, just to confirm, you are using the Preview button to view the template right? Because the for loop only executes and renders when it is run or when you press Preview. Might be a silly question, but it seemed to me like you were only viewing the static content.
Hi Shawn, yes I am watching it in the preview mode or executing the server action that really sends the email. I get an empty email body and mostly the email template's code inside the for loop is changed automatically and put outside the loop for example. Seems the templates are buggy or some code is not really liked and then it behaves very strange.