Hello there,
I had to recreate the public user in one server.
How could I hide this menu item public user - AS when nobody is logged on the website?
Thanks to help.
Odoo is the world's easiest all-in-one management software.
It includes hundreds of business apps:
Hello there,
I had to recreate the public user in one server.
How could I hide this menu item public user - AS when nobody is logged on the website?
Thanks to help.
https://youtu.be/zHPtb1SR8Sk
you can try this module
https://github.com/OCA/website/blob/9.0/website_menu_by_user_status
in short just check request.uid == %(base.public_user)d
<t t-if="request.uid == %(base.public_user)d)"> put you code here </t> |
This I found to work in odoo V12.
<template id="search_directory"name="Online Directory Search"inherit_id="portal.frontend_layout"> <xpathexpr="//ul[@id='top_menu']/li[1]"position="after"><ahref="/search"role="menuitem"groups="base.group_user,online_directory.od_basic_search"class="nav-link">Online Directorya>
xpath>
template>
You can set groups (internal user & portal user) for the website menu in order to hide the menu for public user when not logged in.
Example:
name="group_ids" eval="[(4, ref('base.group_user')), (4, ref('base.group_portal'))]"
Our answer. hanks everybody.
<template id="layout_iv" inherit_id="website.layout" >
<xpath expr="//li[@class='dropdown']" position="replace">
<t t-if="request.uid != %(base.public_user)d">
<li class="divider" t-ignore="true" t-if="website.user_id != user_id"/>
<li class="dropdown" t-ignore="true" t-if="website.user_id != user_id">
<a href="#" class="dropdown-toggle" data-toggle="dropdown">
<b>
<span t-esc="user_id.name"/>
<span class="caret"></span>
</b>
</a>
<ul class="dropdown-menu js_usermenu" role="menu">
<li><a href="/web" role="menuitem">My Account</a></li>
<li class="divider"/>
<li><a t-attf-href="/web/session/logout?redirect=/" role="menuitem">Logout</a></li>
</ul>
</li>
</t>
</xpath>
</template>
Create an account today to enjoy exclusive features and engage with our awesome community!
Sign upRelated Posts | Replies | Views | Activity | |
---|---|---|---|---|
how to get the logged user
Solved
|
|
2
Feb 24
|
13913 | |
|
1
Feb 16
|
4417 | ||
|
1
Aug 15
|
7028 | ||
|
4
Jan 23
|
25800 | ||
|
3
Dec 22
|
6716 |
use record rule perhaps?