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

In odoo12 I want to create a view that only changes something for website 1 and not website 2.

In odoo backend its very simple with the website_id field. But how do I write that in my own module?

Example:

<template id = "test" name="test" inherit_id="test.test_view" priority="16" website_id="1">
<xpath  expr=.....
.... </xpath>
</template>

Doesn't work. What is the right way to create a view that only applies to one specific website and not any other one?

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

Try something like:

<template id = "test" name="test" inherit_id="test.test_view" priority="16">
<t t-if="website.id == 1">
<!-- Content for the first website-->
</t>
<t t-if="website.id == 2">
<!-- Content for the second website-->
</t>
</template>
Ảnh đại diện
Huỷ bỏ
Tác giả Câu trả lời hay nhất

Tried it and it works.

Thank you!

Ảnh đại diện
Huỷ bỏ

you are welcome. please accept the answer then

Bài viết liên quan Trả lời Lượt xem Hoạt động
2
thg 7 25
6115
1
thg 6 24
3035
0
thg 9 22
803
1
thg 1 21
4166
1
thg 1 19
4698