Zum Inhalt springen
Menü
Sie müssen registriert sein, um mit der Community zu interagieren.
Diese Frage wurde gekennzeichnet
7 Antworten
14932 Ansichten

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
Verwerfen
Beste Antwort

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
Verwerfen
Autor

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

Autor

@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

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


Avatar
Verwerfen
Autor Beste Antwort

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
Verwerfen

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

Verknüpfte Beiträge Antworten Ansichten Aktivität
2
Mai 24
8666
0
Juni 20
3698
1
Apr. 23
4235
10
Aug. 15
21711
2
Mai 25
2087