Odoo Help


Is it possible to bind a window action to a first level menu in the sidebar?

Eduardo BP
on 5/2/15, 8:18 AM 943 views

Hi Odoo developers,

I'm following the "Building a module" tutorial from Odoo webpage, and I was wondering if I can bind a window action to a first level menu in the sidebar, because I don't want to create a child menu to do this.

<record model="ir.actions.act_window" id="action_openacademy_list_courses">
<field name="name">Cursos</field>
<field name="res_model">openacademy.course</field>
<field name="view_type">form</field>
<field name="view_mode">tree,form</field>

<menuitem id="openacademy_menu_root" name="Open Academy" sequence="1"/>
<menuitem id="openacademy_menu_coursesroot" name="Course Management"

In the above source code, the "Course Management" menu is a first level menu in the sidebar, but although a window action is associated to it, I can't click in this menu to trigger the action. Is it possible to do this?.

Thank you.

Thank you for your answer Jèrèmy, but what changes should I do in the file addons/web/views/webclient_templates.xml?. I located your code starting in line 162 in this file.

Eduardo BP
on 5/2/15, 12:13 PM

I have updated my response... Let us know...

Jérémy Kersten (jke)
on 5/2/15, 6:14 PM

Thank you Jérémy. I appreciate your help. I'll try your solution.

Eduardo BP
on 5/3/15, 7:56 AM

Jérémy Kersten (jke)

--Jérémy Kersten (jke)--

| 3 3 5
Jodoigne, Belgium
--Jérémy Kersten (jke)--

Jérémy is a member of the core R&D team since september 2013. He developed several projects for OpenERP version 8 including the eCommerce, the Google Calendar synchronization and the new product variants/configurator. Now, he manages Odoo website and themes for saas.

Jérémy Kersten (jke)
On 5/2/15, 11:23 AM

not by default.

Except if you hack the default code here /addons/web/views/webclient_templates.xml


<div class="oe_secondary_menu_section">
<t t-esc="menu['name']"/>
<t t-call="web.menu_secondary_submenu"/>


EDIT: a sample code

It just an idea/method... but you can do all what you want...

In this case, if we have only one children, we do the link on the top menu ...

(Patch here : http://pastesha.re/OjIF?diff)

                                 <t t-foreach="menu['children']" t-as="menu">
+ <t t-set='current_menu' t-value="menu" />
<div class="oe_secondary_menu_section">
- <t t-esc="menu['name']"/>
+ <t t-if="len(current_menu['children']) == 1">
+ <t t-set='menu' t-value="menu['children'][0]" />
+ <t t-call="web.menu_link"/>
+ </t>
+ <t t-if="len(current_menu['children']) != 1">
+ <t t-esc="menu['name']"/>
+ </t>
<t t-call="web.menu_secondary_submenu"/>

About This Community

This platform is for beginners and experts willing to share their Odoo knowledge. It's not a forum to discuss ideas, but a knowledge base of questions and their answers.


Odoo Training Center

Access to our E-learning platform and experience all Odoo Apps through learning videos, exercises and Quizz.

Test it now

Question tools

2 follower(s)


Asked: 5/2/15, 8:18 AM
Seen: 943 times
Last updated: 5/3/15, 7:56 AM