تخطي للذهاب إلى المحتوى
القائمة
لقد تم الإبلاغ عن هذا السؤال
2 الردود
4076 أدوات العرض

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
يوليو 25
6073
1
يونيو 24
3018
0
سبتمبر 22
803
1
يناير 21
4141
1
يناير 19
4655