Skip to Content
Menu
Musisz się zarejestrować, aby móc wchodzić w interakcje z tą społecznością.
To pytanie dostało ostrzeżenie
3 Odpowiedzi
11466 Widoki

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>

 

 

Awatar
Odrzuć
Autor

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.

Najlepsza odpowiedź

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

Awatar
Odrzuć
Autor

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 :)

Powiązane posty Odpowiedzi Widoki Czynność
1
lip 25
2793
1
maj 25
3398
1
kwi 25
3100
1
lut 25
2459
0
paź 24
2021