I too have a doubt in using the jinja tag in the below code.
I have already written code for BOM doctype items child table where I can fetch the remarks filed eventhough it is partially filled.
table, th, td {
background-color: white;
margin-top: 6px;
font-size: 11px;
}
table {
border-collapse: collapse;
}
td:nth-child(1),
td:nth-child(3),
td:nth-child(4),
td:nth-child(5),
td:nth-child(6) {
text-align: center;
}
td:nth-child(1),
td:nth-child(3),
td:nth-child(4),
td:nth-child(5),
td:nth-child(6),
td:nth-child(7),
td:nth-child(8),
td:nth-child(9),
{
vertical-align: middle;
}
{%- for row in doc.items-%}
{% if row.remarks %}
{% else %}
{% endif %}
{%- endfor -%}
SI No |
Item Description |
Req.Qty |
BIN Qty |
Scrap Qty |
UOM |
Remarks |
Rate |
Amount |
{{ row.idx }} |
{{row.item_code}}
{{row.item_name}} |
{{ row.qty}} |
{{ row.bin_qty}} |
{{ row.scrap_qty}} |
{{ row.uom}} |
{{ row.remarks }} |
|
{{ row.get_formatted("rate", doc) }} |
{{ row.get_formatted("amount", doc) }} |
Now i have made few changes in the above code because in some documents in BOm doctype the remarks feld is totally in such case I want to eliminate the Remarks column .
This below code is showing error .
The code is
table, th, td {
background-color: white;
margin-top: 6px;
font-size: 11px;
}
table {
border-collapse: collapse;
}
td:nth-child(1),
td:nth-child(3),
td:nth-child(4),
td:nth-child(5),
td:nth-child(6) {
text-align: center;
}
td:nth-child(1),
td:nth-child(3),
td:nth-child(4),
td:nth-child(5),
td:nth-child(6),
td:nth-child(7),
td:nth-child(8),
td:nth-child(9),
{
vertical-align: middle;
}
{% set remarks_exist = false %}
{%- for row in doc.items-%}
{% if row.remarks %}
{% set remarks_exist = true %}
{% break %}
{% endif %}
{% endfor %}
{% if remarks_exist %}
{%- for row in doc.items-%}
{% if row.remarks %}
<td>{{ row.remarks }}</td>
{% else %}
<td></td>
{% endif %}
<td style="text-align:left">{{ row.remarks}}</td>
<td style="text-align:left">{{ row.get_formatted("rate", doc) }}</td>
<td style="text-align:left">{{ row.get_formatted("amount", doc) }}</td>
</tr>{%- endfor -%}
</tbody>
</table>
{% endif %}
The error message is
SI No |
Item Description |
Req.Qty |
BIN Qty |
Scrap Qty |
UOM |
Remarks |
Rate |
Amount |
{{ row.idx }} |
{{row.item_code}}
{{row.item_name}} |
{{ row.qty}} |
{{ row.bin_qty}} |
{{ row.scrap_qty}} |
{{ row.uom}} |