<tbody>
<tr t-foreach="o.line_ids.filtered(lambda line: line.appears_on_payslip)" t-as="line">
<t t-if="line.code in ('BASIC','OT','DED','GROSS','NET')">
<td><span t-field="line.code"/></td>
<td><span t-field="line.name"/></td>
<td><span t-field="line.quantity"/></td>
<td><span t-field="line.amount" t-esc-options='{"widget": "monetary", "display_currency": o.company_id.currency_id}'/></td>
<td><span t-field="line.total" t-esc-options='{"widget": "monetary", "display_currency": o.company_id.currency_id}'/></td>
</t>
</tr>
</tbody>
Приведенный выше код является телом таблицы в отчете qweb. Вместо «line.quantity» я хочу вызвать функцию Python «o.compute_overtime()» и написать так:
<t t-if="line.code=='OT'">
<td><span t-esc="i['ot_total']"/></td>
</t>
Как я могу вызвать функцию только для 1 поля?