Bỏ qua để đến Nội dung
Menu
Câu hỏi này đã bị gắn cờ
2 Trả lời
1906 Lượt xem

I try inherit survey.question_container like this

<template id="question_container_inherit" inherit_id="survey.question_container" primary="True">
    <xpath expr="//div[@t-att-id='question.id']" position="replace">
            <p>New text</p>
        </xpath>
    </template>

I think the inherit is success, odoo able to find the ID and the expression (since there is no error).

I expect the answer option will be replaced by text "New text"

But when I open survey template, nothing happen. no change in the view.



How to reproduce :

- just put xml code above into xml and install or upgrade the module






Ảnh đại diện
Huỷ bỏ
Tác giả

I already make sure there is no module that also inherit question_container
id question_container is in "odoo/addons/survey/views/survey_templates.xml"

Tác giả

I also make sure the module is upgraded.
When I said "nothing happen". I mean the survey template is still look like odoo based. There is no change. The view is rendered properly, but the option still exist (it should have been replaced by "New text"

Câu trả lời hay nhất

Hello in you case, please remove primary=True please because it create a new view base on original view no inheriting it

Ảnh đại diện
Huỷ bỏ
Câu trả lời hay nhất

Hi,

Try this way.

Thanks

Ảnh đại diện
Huỷ bỏ
Tác giả

Still no change. Did it work in your local? besides changing the element from <p> tag to <div> tag, what is the difference?

when you replace any element through the xpath when added inside expr element should be replace so that is why add div tag instead of paragraph tag.
may be your file is not run or inside manifest you not added .
first check this scenario.

Tác giả

it is run and inside manifest. If I put the wrong expression, it will show error that it cannot find the element from the parent. The fact that it didn't show any error but no change in the view that confused me

Bài viết liên quan Trả lời Lượt xem Hoạt động
1
thg 6 24
1265
1
thg 6 24
1433
0
thg 4 25
367
0
thg 7 24
1077
0
thg 6 24
1405