Passa al contenuto
Menu
È necessario essere registrati per interagire con la community.
La domanda è stata contrassegnata
2 Risposte
3873 Visualizzazioni

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
Abbandona

<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.

Risposta migliore

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

This might work.

Avatar
Abbandona
Risposta migliore
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
Abbandona
Autore

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.

Post correlati Risposte Visualizzazioni Attività
0
ott 20
3139
4
ott 19
3926
2
feb 22
8279
0
ago 20
3738
1
ott 22
3755