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

i have a loop on dict doc 

<t t-if="doc[currency_id] != 'SDG'">
<t t-set="total1" t-value="total1+ doc['tuition']"/>
</t>


Avatar
Discard

<t t-set="total1" t-value="0"/>

<t t-if="doc.currency_id.display_name != 'SDG'">

<t t-set="total1" t-value="total1+ doc['tuition']"/>

</t>

Please stop using user names as tags for your posts.

Best Answer

Try this : 
<t t-if="doc['currency_id'] !== 'SDG'">
    <t t-set="total1" t-value="total1+ doc['tuition']"/>
</t>

This might work.

Avatar
Discard
Best Answer
You can do it as like you are doing in python.



<t t-if="doc['currency_id'] != 'SDG'">
<t t-set="total1" t-value="total1+ doc['tuition']"/>
</t>
Avatar
Discard
Author

it does not work , i get

Error to render compiling AST

KeyError: None

Template: 754

Path: /templates/t/t/div[2]/table/tbody/t[10]/tr/td[3]/t

Node: <t t-if="doc[currency_id] != 'SDG'">

<t t-set="total1" t-value="total1+ doc['tuition']"/>

</t>

Please add currency_id in single quotes.

Related Posts Replies Views Activity
0
Oct 20
2519
4
Oct 19
3066
2
Feb 22
6917
0
Aug 20
2840
1
Oct 22
2668