This question has been flagged
7 Replies
13288 Views

I'm creating custom navbar links like so:

```

<record id="aboutus_page_link" model="website.menu">  
 
<field name="name">About Us</field>
<field name="url">/page/about-us</field>
<field name="parent_id" ref="website.main_menu" />
<field name="sequence" type="int">10</field>

</record>

```

And am wondering if it's possible to create dropdowns within those links. Possibly creating a new record with some parent reference, or something?

Avatar
Discard
Best Answer

Hi

It will help You 


Top menu(Drop down)

<record id="menu_parent" model="website.menu"> 
    <field name="name">Parent Menu</field>
    <field name="parent_id" ref="website.main_menu"/>
    <field name="sequence" type="int">50</field>
</record>

Child menu (Drop down content)

<record id="menu_child" model="website.menu">
    <field name="name">Child menu</field>
    <field name="url">/foo</field>
    <field name="parent_id" ref="menu_parent"/>
     <field name="sequence" type="int">10</field>
 </record>

In Python File

from openerp import http, _ 
from openerp.http import request

class Bar(http.Controller):
    @http.route('/foo', type='http', website=True, auth="public")
    def page_certificate_verification(self, **kw):
        return request.render('Your_module.your_template')

In xml

<template id="your_template">
    <t t-call="website.layout">
        <div id="wrap">
            <div class="oe_structure"/>
             <div class="container">
                 <!--Your Contents-->
                 <h1>Foo</h1>
`            </div>
         </div>
     </t>
</template>


Avatar
Discard
Author

@shameem@aχon Thank you so much! This is EXACTLY what I was looking for. I knew it would be something easy like this!

Author

@shameem@aχon Regarding your custom controller, when I `return request.render('theme_worldbuilders.aboutus.xml')` I still get a 404. I think I'm not doing this right. Also, my aboutus.xml is in views/innerpages/, how am I supposed to reference that?

i want one sub menu into another sub menu...? i try follow this same procedure at 3rd menu... but its not working. Please advice Shameem Babu @ iWesabe

Best Answer
.dropdown:hover>.dropdown-menu {
    display: block;
}
Add this CSS, It's 100% work.


Avatar
Discard
Author Best Answer

Regarding your custom controller, when I ```return request.render('theme_worldbuilders.aboutus.xml')``` I still get a 404. I think I'm not doing this right. Also, my aboutus.xml is in views/innerpages/, how am I supposed to reference that?

Avatar
Discard

You pass the file name instead of template id

You create a template in the file aboutus.xml

then

return request.render('Your_module.your_template_id')