This question has been flagged

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

Avatar
Discard
Best Answer

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

Avatar
Discard
Author

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

Author

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

Best Answer

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

Avatar
Discard