March 2018
Beginner to intermediate
336 pages
8h 22m
English
A block of HTML can be repeated by iterating through a loop. We can use it to add the avatars of the task followers to the task's Kanban card.
Let's start by rendering just the partner IDs of the task, as follows:
<t t-foreach="record.message_partner_ids.raw_value" t-as="rec"> <t t-esc="rec" />; </t>
The t-foreach directive accepts a JavaScript expression evaluating to a collection to iterate. In most cases, this will be just the name of a to-many relation field. It is used with a t-as directive to set the name to be used to refer to each item in the iteration.
The t-esc directive used next evaluates the provided expression, just the rec variable name in this case, and renders it as safely escaped HTML.
In the previous ...
Read now
Unlock full access