Перейти к содержимому
Меню
Чтобы взаимодействовать с сообществом, необходимо зарегистрироваться.
Этот вопрос был отмечен
6 Ответы
11055 Представления

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?

Аватар
Отменить
Лучший ответ

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.  

Аватар
Отменить
Автор

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

Автор

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.

Лучший ответ

Hello Andrzej,

This is a module that does exactly that:

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

Аватар
Отменить
Related Posts Ответы Просмотры Активность
0
февр. 22
1878
0
февр. 21
1905
6
авг. 19
10086
1
февр. 24
2719
0
февр. 24
1421