Skip to Content
Menu
This question has been flagged
2 Replies
3529 Views

i want total marks of student for this i have no of records from number of records i will take number of marks and i want to print it within xml tags without using python methods.


 <td t-foreach="get_objects(docs)" t-as="objs">

<t t-foreach="get_lines(objs)" t-as="lines">

<t t-foreach="lines" t-as="line">

<t class="text-center">
<span t-raw="'%s' % line.marks if line.marks else''"/>
</t>


</t>

</t>

</td>
i want to calculate total marks of 

 <span t-raw="'%s' % line.marks if line.marks else''"/>
thanks 
Avatar
Discard
Best Answer

Hi,

You can try like this,

<t t-foreach="get_lines(objs)" t-as="lines">
<t t-set="total_marks" t-value="0"/>
<t t-foreach="lines" t-as="line">
<t class="text-center">
<span t-raw="'%s' % line.marks if line.marks else''"/>
<t t-set="total_marks" t-value="total_marks + line.marks"/>
</t>
</t>
<span>Total Mark:<t t-esc="total_marks"/></span>
</t>

Thanks

Avatar
Discard