Template issue for embedding PO items in Email Alert for PO

I want to embedd the Purchase Order Item Table in the Email Alert.

By
what I can build is a very crude tabular format ( sample alert as per
below ) and also the lookp ( %for items and %end For ) doesnt seem to
quiet well work inside the code as per attached txt file.

If
try to make any changes to the attached code, and when I try to save
the changes in the email alert, automatically the % for items & %end
for reposition themselves randomly and my alert template is not usable

what could be the issue,

also please help correctly format the print format code to be embedded in email alert so that I can use this.

awaiting help.

Regards,
Mahesh

PS : This is further to my earlier simillar post of 24/05/2016

Heres the script I had been working around…

Purchase Order {{ doc.name }} has been Created<hr>

<p>SUPPLIER: {{ doc.supplier_name }}<br>

PO Created by: {{ doc.owner }}<br>

PO Reference :

<span style="text-align: left; vertical-align: middle;">{{ _("#") }}{{ doc.name }}</span> {{ _("PO To:") }}: {{ doc.supplier_name }}<br>

{{ _("Address") }}: {{ doc.address_display }}</p>

<hr>

TITLE: {{ doc.title}}<br>


{% for row in doc.items %}


<table class="table table-condensed table-hover table-bordered" width="802">

<tbody><tr>

 

<th width="50">Sr</th>


<th width="100">Cat No</th>

<th width="400">Description</th>

<th class="text-right" width="100">Qty</th>

    <td align="right" style="border-style: none; border-width: medium;" width="187">

    <p dir="ltr">Pricelist Rate</p></td>

    <td align="right" style="border-style: none; border-width: medium;" width="187">

    Discount</td>

    <td align="right" style="border-style: none; border-width: medium;" width="187">Rate</td>

    <td align="right" style="border-style: none; border-width: medium;" width="176">Amount</td>

</tr><tr><td width="188">{{ row.idx }}</td>


<td width="188">{{ row.item_code }}</td>

<td width="187">{{ row.description }}<br>

{{ row.required_for }}
<p>}}</p></td>

<td width="187">{{ row.qty }} {{ row.uom or row.stock_uom }}</td>

    <td align="right" style="border-style: none; border-width: medium;" width="187">

 

{{

row.get_formatted("price_list_rate", doc) }}</td>

    <td align="right" style="border-style: none; border-width: medium;" width="187">

 

{{

row.get_formatted("discount_percentage", doc) }}</td>

    <td align="right" style="border-style: none; border-width: medium;" width="187">

 

{{

row.get_formatted("rate", doc) }}</td>

    <td align="right" style="border-style: none; border-width: medium;" width="176">

 

{{

row.get_formatted("amount", doc) }}</td>

</tr></tbody></table>

{% endfor %}

{{ doc.terms}}

@malani_mahesh Will look into this. Thanks for reporting.

Pushed this: [fix] email alert message changed to Code and ignore xss filtering by rmehta · Pull Request #2247 · frappe/frappe · GitHub