Search code examples
pythonodooodoo-8odoo-9odoo-website

How to change header URL after user logged in in Odoo 8/9?


I am making a website on Odoo 9, extending website and web module, and creating a custom theme. I have added a few pages to the header of my website, and one of those is a Sign In page, in which a user can sign in my website.

My problem is that when the user logs in, the "Sign In" is still there, and I want this to change to "My Profile" page, for the user to handle its profile settings.

How can I check if user is logged and change the element in the header?


Solution

  • Isn't website module already have a sign page? anyway, you can inherit website.layout to customize the website menu, try this :

    <template id="custom_sign_in" customize_show="True" inherit_id="website.layout" name="Custom Sign In">
        <xpath expr="//ul[@id='top_menu']" position="inside">
            <li groups="base.group_public">
                <a t-attf-href="/web/YourSignInPage">
                    <b>Custom Sign in</b>
                </a>
            </li>
            <li t-if="website.user_id != user_id">
                <a t-attf-href="/web/YourAccountPage">
                    <b>Custom Account</b>
                </a>
            </li>
        </xpath>
    </template>
    

    I am using odoo 8, not sure if that will be suitable for odoo 9, let me know if it doesn't work.