Skip to Content
เมนู
คุณต้องลงทะเบียนเพื่อโต้ตอบกับคอมมูนิตี้
คำถามนี้ถูกตั้งค่าสถานะ
2 ตอบกลับ
4083 มุมมอง

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?

อวตาร
ละทิ้ง
คำตอบที่ดีที่สุด

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>
อวตาร
ละทิ้ง
ผู้เขียน คำตอบที่ดีที่สุด

Tried it and it works.

Thank you!

อวตาร
ละทิ้ง

you are welcome. please accept the answer then

Related Posts ตอบกลับ มุมมอง กิจกรรม
2
ก.ค. 25
6074
1
มิ.ย. 24
3021
0
ก.ย. 22
803
Set field invisible if False แก้ไขแล้ว
1
ม.ค. 21
4148
1
ม.ค. 19
4673