I have a list of objects and I want to loop over this list and get properties of each object. How should loop over the list and get each item of the list to get the objects fields?
You can use t-foreach
in QWeb and iterate over sequence types like lists, sets or Odoo recordsets.
Following is a bigger example from Odoo's Lunch App (V10):
<tbody>
<t t-foreach="docs.read_group([('id', 'in', docs.ids)],['user_id'],['user_id'])" t-as="o">
<t t-set="user" t-value="user.browse(o['user_id'][0])"/>
<t t-set="lines" t-value="docs.search([('user_id', '=', user.id), ('id', 'in', docs.ids)])"/>
<tr>
<td colspan="2">
<strong t-field="user.name"/>
</td>
<td class="text-right" colspan="2">
<strong>
<span t-esc="sum(line.price for line in lines)"/>
<span t-field="user.company_id.currency_id.symbol"/>
</strong>
</td>
</tr>
<tr t-foreach="lines" t-as="line">
<td>
<span t-field="line.date"></span>
</td>
<td>
<span t-field="line.product_id.name"/>
</td>
<td>
<span t-field="line.note"/>
</td>
<td class="text-right">
<span t-field="line.price"
t-options='{"widget": "monetary", "display_currency": user.company_id.currency_id}'/>
</td>
</tr>
</t>
</tbody>