如何为网站导航odoo 13创建自定义模板 [英] How to create a custom template for the website navigation odoo 13
本文介绍了如何为网站导航odoo 13创建自定义模板的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
如何为网站navbar创建自定义的odoo walker
How to create a custom odoo walker for the website navbar
类似于Wordpress允许创建html模板的东西,他们使用odoo来添加菜单,以便我可以设计导航
Similar to what Wordpress allows to create a html template which them odoo uses to add the menus so I can design the navigation
<nav>
<div class="logo"></div>
<ul>
<!-- odoo menu items--->
<!-- formatting--->
<!-- <li class="nav-item"><a href="$link"> $name </a></li>--->
</ul>
<div>
<ul>
<li><a href="$myaccount_link">$name</a></li>
<li><a href="$logout_link"> $name</a></li>
</ul>
</div>
</nav>
在odoo中是否有类似的功能
Is there a similar function in odoo
如果不是,如何在JS的odoo中获取所有活动菜单
if not how to get all the active menus in odoo in JS
推荐答案
这是一种解决方法,您可以在addons/portal/views/portal_templates.xml中找到代码.
this is a work around, you can find the code in addons/portal/views/portal_templates.xml.
<div class="collapse navbar-collapse" id="top_menu_collapse">
<!-- FIXME We want menu to open to the right by default (except cases handled in JS) -->
<ul class="nav navbar-nav ml-auto text-right" id="top_menu">
<li class="nav-item divider" t-ignore="true" t-if="not user_id._is_public()"/>
<li class="nav-item dropdown" t-ignore="true" t-if="not user_id._is_public()">
<a href="#" class="nav-link dropdown-toggle" data-toggle="dropdown">
<b>
<span t-esc="user_id.name[:23] + '...' if user_id.name and len(user_id.name) > 25 else user_id.name"/>
</b>
</a>
<div class="dropdown-menu js_usermenu" role="menu">
<a id="o_logout" class="dropdown-item" t-attf-href="/web/session/logout?redirect=/" role="menuitem">Logout</a>
</div>
</li>
</ul>
</div>
_is_public()方法返回"True",如果用户"没有记录,否则为假
the method _is_public() return True if the "user" is not logged else false
这篇关于如何为网站导航odoo 13创建自定义模板的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文