Ing
Ing

Reputation: 611

How to sum fields in a view Qweb? Odoo 14

how can sum 2 values in qweb ? I want to add span with the sum values of field1 + field2.

<span t-field="doc.field1"/>
 <span t-field="doc.field2"/>

Thanks.

Upvotes: 0

Views: 260

Answers (1)

Bhavesh Odedra
Bhavesh Odedra

Reputation: 11143

Try with this:

<t t-set="total" t-value="doc.field1 + doc.field2"/>

Now you can use total variable for display.

For example:

<span t-esc="total"/>

Upvotes: 2

Related Questions