Skip to Content
Menu
You need to be registered to interact with the community.
This question has been flagged
3 Odgovori
11152 Prikazi

Can someone tell me how it works? I have not found the description in the documentation.

Examples:

<link rel='stylesheet' href='/website/static/src/css/bootswatch/amelia.min.css' t-ignore="true"/>

<t t-ignore="true">
....
</t>

<div class="pull-right" t-ignore="true" t-if="not editable">
...
</div>

 

 

Avatar
Opusti
Avtor

No one knows?

The "t-ignore" attribute keeps the elements from inheriting the "branding" of the parent when you enable inherited branding. Branding being the "data-oe-*" and "t-*" attributes. Seems to be used in keeping track of where tags get moved to. See example of usage in report/models/report.py See also ir_qweb.py, and ir_ui_view.py See addons/base/tests/test_views.py, Hope that helps.

Best Answer

Hi Zbik,

If the t-ignore value is set to True Odoo will no longer append all attributes to the element. It basically ignores setting all the 'extra' attributes you can have on an element in XML/HTML. Have a look at this XML example:

<a class="your_class" t-attf-href="#{record.name}">Your title</a>

This will render in HTML like this:

<a class="your_class" data-oe-model="ir.ui.view" data-oe-id="2178" data-oe-field="arch" data-oe-xpath="/t[1]/t[1]/div[1]/a[1]" href="YourName">Your title<div></div></a>

Now let us do the exact same thing but let us add the t-ignore=True:

<a class="your_class" t-attf-href="#{record.name}" t-ignore="True">Your title</a>

If you'd look at the rendered HTML now it would look like this:

<a class="your_class" href="YourName">Your title</a>

As you can see all the HTML attributes are no longer applied on the XML element and you will have a basic HTML structure. You can see in the ir_ui_view.py file what the logic is and how it is handled. see the official code

Regards,

Yenthe

Avatar
Opusti
Avtor

Yenthe, thanks for the detailed answer. Today it is known to me but probably it can be useful to others.

Yeah I saw it was still unanswered and landed here from a Google redirect so I thought I might as well explain it :)

Related Posts Odgovori Prikazi Aktivnost
1
jul. 25
2309
1
maj 25
2683
1
apr. 25
2753
1
feb. 25
2042
0
okt. 24
1752