OD325 t-esc-removed¶
The server no longer renders t-esc in a QWeb view; use t-out.
| Category | Severity | Series | Needs the index |
|---|---|---|---|
| Deprecation | Error | saas~19.1 and later | no |
What it reports¶
A t-esc attribute on an element that a QWeb view adds: a <template>, or an ir.ui.view record
whose tree is QWeb, such as one inheriting a <template>. A spec that locates the parent's element
by its t-esc is not reported. Archs the web client compiles, such as a kanban view's templates,
are not checked, and neither are the Owl templates under static/: the client still renders
t-esc in both.
Why it matters¶
Odoo 15.0 replaced t-esc with t-out, and up to 19.0 the server still renders t-esc as
t-out, with a deprecation warning in developer mode. From saas~19.1 the server no longer knows
the directive: it logs it among the unknown directives of the template and renders the element
without the value. A report, an email or a website page ported unchanged installs and renders,
with its names, amounts and dates silently missing.
t-out escapes a plain value exactly as t-esc did, so the rename keeps the output the same.
Modules of 19.0 and earlier are not checked, since t-esc still renders there and core itself
uses it widely.
Example¶
<template id="report_delivery_note_document">
<div class="page">
<h2 t-esc="doc.name"/>
<span t-esc="doc.scheduled_date" t-options="{'widget': 'date'}"/>
</div>
</template>
Both elements render empty from saas~19.1: the delivery note prints without its reference and date.
<template id="report_delivery_note_document">
<div class="page">
<h2 t-out="doc.name"/>
<span t-out="doc.scheduled_date" t-options="{'widget': 'date'}"/>
</div>
</template>
Fixing¶
oscn check --fix renames t-esc to t-out, unless the element also has t-out, t-field or
t-raw, of which Odoo renders only one, or a view in its inheritance tree locates an element by
its t-esc, through a spec or an xpath, and would no longer find it. A view setting t-esc or
t-field with <attribute> keeps the rename off too, since t-out would win over its value, and
so does one that adds to, removes from or empties t-out, which would then join the renamed value
or delete it. A t-esc with a prefix, as x:t-esc, or from a DOCTYPE entity is reported and
left as it is.
See fixing findings.