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

I need to hide footer on one of the websites while using Multi-Website module.

What is the best practice to do so? I saw a flag inside web.frontend_layout that dictates if footer should be rendered. But how do I control this variable depending on a current website? I'm using different domains for different websites.


<footer t-if="not no_footer" id="bottom" data-anchor="true" class="bg-light o_footer">


Using Odoo 13

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

https://youtu.be/8aNTIxa-qRE

อวตาร
ละทิ้ง
ผู้เขียน

Hey, thank you for the response.

I'm aware of this already, but to me it feels more like a "hack" not a proper solution.

This is standard feature to customise header/footer for multi website

ผู้เขียน

Also are you sure it is "request.website_id"? For me it says that request does not have property website_id. But something like this is working: website.id == 2

คำตอบที่ดีที่สุด

I'm open to suggestions but I think the best solution would be to add a field to the website module.

from odoo import models, fields

class WebsiteInherited(models.Model)
    _inherit = 'website'
    no_footer = fields.Boolean(string='Website Footer', default=False)


Then create an xpath to the footer

<template id="footer_custom" inherit_id="website.footer_custom" name="Footer">
<xpath expr="//div[@id='footer']" position="attributes">
<attribute name="t-if">not request.website_id.no_footer</attribute>
</xpath>
</template>

Untested but I assume something like that.


Edit:

I forgot to mention you'll have to add the no_footer to the website view so you'll be able to change the value

อวตาร
ละทิ้ง
Related Posts ตอบกลับ มุมมอง กิจกรรม
1
ก.ย. 20
3291
0
ก.พ. 24
1154
Can't add footer to my website (v13) แก้ไขแล้ว
2
ก.ย. 22
6561
0
มี.ค. 22
1812
1
พ.ย. 22
2262