Search code examples
odooodoo-10qweb

Odoo 10 - Qweb report, multiply two fields


How can I multiply two fields in Odoo Qweb report? I have seen that there is an option to sum several fields/items:

<t t-set="subtotal" t-value="sum(line.price_subtotal for line in layout_category['lines'])"/>

Can I multiply two fields/values?


Solution

  • To stay in your example:

    <t t-set="subtotal"
        t-value="sum([line.field1 * line.field2 for line in layout_category['lines']])"/>