Skip to Content
Menu
This question has been flagged

Hi,

I'm experiencing a problem in Odoo v11 regarding the QWeb templating engine and the branding system (data-oe-* attributes).

When I insert a <header> inside a view using QWeb inheritance, everything works fine unless I include a <t t-esc="..."/> tag somewhere inside the header. In that case, the data-oe-id, data-oe-xpath, etc. branding attributes are not applied correctly to the <header> element. As a result, it becomes impossible to edit the header's background-image (and other styles) in the website editor.
<xpath expr="//div[@id='wrap']//div[hasclass('oe_structure')]" position="before">

 <xpath expr="//div[@id='wrap']//div[hasclass('oe_structure')]" position="before">
    <!-- Header -->
    <header class="header s_header text-white"
            style="background-color: #b9a0c9;">
        <div class="overlay opacity-75"
             style="background-image: linear-gradient(to top, #0d8464 0%, #4c8bb1 100%);"/>
        <div class="container text-center">
            <div class="row">
                <div class="col-md-8 mx-auto">
                    <h1 class="display-41">Our Events</h1>
                    <p class="lead-2 opacity-90">
                        <t t-esc="current_date"/>
                    </p>
                    <p class="lead-2 opacity-90">
                        <!--<t t-esc="current_type.name"/>-->
                    </p>
                    <p class="lead-2 opacity-90">
                        <!--<t t-esc="current_country.name"/>-->
                    </p>
                </div>
            </div>
        </div>
    </header>
</xpath>

If even one <t t-esc="..."/> tag is present (not commented out), the branding fails. If I remove or comment out all <t t-esc> tags, the header gets properly branded and can be edited visually via the website editor. Same problem occurs when I use t-field.

This makes me think the branding system (inherit_branding function in the backend) is incorrectly identifying the parent element when QWeb control tags like <t t-esc> are used.

Can anyone provide insight into why this happens? Is this a known issue or limitation in v11? Any workarounds or patches would be greatly appreciated.

Thanks in advance!

Avatar
Discard
Related Posts Replies Views Activity
2
Jun 24
12132
2
Aug 20
4075
1
Mar 24
3530
1
Jul 23
11154
1
Mar 22
4047