Skip to Content
Meniu
Trebuie să fiți înregistrat pentru a interacționa cu comunitatea.
Această întrebare a fost marcată
6 Răspunsuri
11039 Vizualizări

I'm trying to add my logo to the top navbar like this:

https://i.imgur.com/0J54fbh.png

I modified the xml file "addons\web\static\src\xml\menu.xml" and added my div inside the header:

<header t-name="Menu">
  <nav class="o_main_navbar">
      <ul class="o_menu_apps"/>
      <div style="height: 100%;display: block;float: left;margin-right: 15px;margin-left: 15px;">
          <img src="https://www.clubsportive.nl/wp-content/uploads/2018/12/logo-example.jpg" height=100%/>
      </div>
      <a class="o_menu_brand" role="button"/>
      <ul class="o_menu_sections" role="menu"/>
      <ul class="o_menu_systray" role="menu"/>
  </nav>
</header>

But it breaks whole odoo. I see only white screen.

In console I have errors like this:
https://i.imgur.com/MSPCNni.png

How do I do this?

Imagine profil
Abandonează
Cel mai bun răspuns

Never modify the original files, create an custom module and inherit the template. Look at the assets what version of bootstrap it uses and then use xpath to add into it the "brand" class and add img into it.  

Imagine profil
Abandonează
Autor

I'm having trouble locating the view to inherit. What is ID of the view resposible for the top navbar? How do I targed propper element with xpath?

this is for menu of odoo10 <template id="logo_menu_addition" inherit_id="web.menu">, xpath example <xpath expr="//nav[@id='oe_main_menu_navbar']" position="after">. https://www.w3schools.com/xml/xml_xpath.asp

Autor

Sadly this does not work anymore. Any idea how to get the current model?

It was just an example for you as a guideline how to try to do it on odoo 12, so the id in xpath maybe doesn't even exist, because it uses a newer bootstrap. The inherited ID is from adding something to the odoo 10 backend menu, not a logo. I'm not working yet on odoo 12. If you're trying to do this to a website then just find a template that has that feature and copy the code. Odoo 12 has a different menu structure than Odoo 10 in the backend.

Cel mai bun răspuns

Hello Andrzej,

This is a module that does exactly that:

https://apps.odoo.com/apps/modules/12.0/web_company_logo/

Imagine profil
Abandonează
Related Posts Răspunsuri Vizualizări Activitate
0
feb. 22
1869
0
feb. 21
1898
6
aug. 19
10069
1
feb. 24
2700
0
feb. 24
1395