December 2018
Beginner to intermediate
404 pages
10h 14m
English
A block of HTML can be repeated by iterating through a loop. We can use it to add the avatars of the record followers.
Let's start by rendering just the partner IDs of the record, 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's 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 example, we loop through ...
Read now
Unlock full access