Skip to Content
Menu
Musisz się zarejestrować, aby móc wchodzić w interakcje z tą społecznością.
To pytanie dostało ostrzeżenie
6 Odpowiedzi
11049 Widoki

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?

Awatar
Odrzuć
Najlepsza odpowiedź

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.  

Awatar
Odrzuć
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.

Najlepsza odpowiedź

Hello Andrzej,

This is a module that does exactly that:

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

Awatar
Odrzuć
Powiązane posty Odpowiedzi Widoki Czynność
0
lut 22
1876
0
lut 21
1903
6
sie 19
10080
1
lut 24
2715
0
lut 24
1412