跳至内容
菜单
此问题已终结
2 回复
4087 查看

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

相关帖文 回复 查看 活动
2
7月 25
6077
1
6月 24
3023
0
9月 22
803
1
1月 21
4149
1
1月 19
4677