Rendering values – t-esc and t-raw

We used the <field> element to render the field content. But field values can also be presented directly without a <field> tag.

The t-esc directive evaluates an expression and renders it as an HTML-escaped value, as shown in the following:

<t t-esc="record.message_parter_ids.raw_value" />

In some cases, and if the source data is guaranteed to be safe, t-raw can be used to render the field raw value without any escaping, as shown in the following example:

<t t-raw="record.message_parter_ids.raw_value" />

For security reasons, it is important to avoid using t-raw as much as possible. Its usage should be strictly reserved for outputting HTML data that was specifically prepared without any user data in it, ...

Get Odoo 11 Development Essentials - Third Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.