Skip to content

Commit 038b45c

Browse files
committed
Update QWeb static template example to use 't-out' attribute instead of deprecated 't-esc'
1 parent 8909e46 commit 038b45c

File tree

1 file changed

+13
-3
lines changed

1 file changed

+13
-3
lines changed

docs/source/custom-code/edit-static-template-text.rst

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ For this example we will use a template from the standard module `website_sale`:
2727
...
2828
</t>
2929
</templates>
30+
3031
Source: https://github.com/odoo/odoo/blob/d380a3a42dc39451fa26f161cc0b955b2f0098fd/addons/website_sale/static/src/js/product_configurator_dialog/product_configurator_dialog.xml
3132

3233

@@ -37,8 +38,8 @@ This one is pretty straightforward, you need to create a new module that overrid
3738

3839
Xpath does not support direct text replacement. But fortunately there is some workaround.
3940

40-
Using `t-esc` or `t-raw`
41-
------------------------
41+
Using `t-out` attribute
42+
-----------------------
4243

4344
Don't forget to put the value in quotes, otherwise it will be interpreted as a variable and will cause an error if the variable does not exist.
4445

@@ -48,11 +49,20 @@ Don't forget to put the value in quotes, otherwise it will be interpreted as a v
4849
<templates xml:space="preserve">
4950
<t t-inherit="sale.ProductConfiguratorDialog" t-inherit-mode="extension">
5051
<xpath expr="//button[@name='website_sale_product_configurator_continue_button']" position="attributes">
51-
<attribute name="t-esc">"New Text"</attribute>
52+
<attribute name="t-out">"New Text"</attribute>
5253
</xpath>
5354
</t>
5455
</templates>
5556
57+
.. warning::
58+
59+
Using raw text like this is not recommended, as it will NOT be taken into account in translations.
60+
61+
.. note::
62+
63+
`t-esc` and `t-raw` are both deprecated and should not be used anymore. See:
64+
https://www.odoo.com/documentation/18.0/developer/reference/frontend/qweb.html#deprecated-output-directives
65+
5666
Overriding the whole element
5767
----------------------------
5868

0 commit comments

Comments
 (0)