Bỏ qua để đến Nội dung
Menu
Câu hỏi này đã bị gắn cờ

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!

Ảnh đại diện
Huỷ bỏ
Bài viết liên quan Trả lời Lượt xem Hoạt động
2
thg 6 24
12137
2
thg 8 20
4080
1
thg 3 24
3531
1
thg 7 23
11166
1
thg 3 22
4047