Odoo Help

Welcome!

This community 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.

0

Dropdowns for custom navigation menu items?

By
Tech Support
on 10/18/16, 1:22 PM 226 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?

1
shameem@aχoncoms
On 10/19/16, 1:54 AM

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>


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

Tech Support
on 10/19/16, 11:37 AM

@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?

Tech Support
on 10/20/16, 9:14 AM
0
Tech Support
On 10/20/16, 9:12 AM

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?

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')

shameem@aχoncoms
on 10/20/16, 11:18 PM

Your Answer

Please try to give a substantial answer. If you wanted to comment on the question or answer, just use the commenting tool. Please remember that you can always revise your answers - no need to answer the same question twice. Also, please don't forget to vote - it really helps to select the best questions and answers!

About This Community

This community is for professionals and enthusiasts of our products and services. Read Guidelines

Question tools

1 follower(s)

Stats

Asked: 10/18/16, 1:22 PM
Seen: 226 times
Last updated: 10/20/16, 9:12 AM