Skip to Content
Menu
You need to be registered to interact with the community.
This question has been flagged
2 Odgovori
794 Prikazi

I'd like to add a menu to the odoo site. I wanted to inject the new item directly into model.website, but I've noticed that it persists in the database and if I change the url, I have to raze everything before it takes. I read somewhere that I could do template inheritance, but I don't understand how it works. I've looked through articles without really understanding. I still have this error, but when I go to the browser inspector, I can see this class.


Error : "RPC_ERROR


Odoo Server Error


Occured on localhost:8069 on model ir.module.module and id 34 on 2025-07-21 13:07:12 GMT


Traceback (most recent call last):

  File "/usr/lib/python3/dist-packages/odoo/convert.py", line 548, in _tag_root

    raise ParseError(msg) from None  # Restart with "--log-handler odoo.tools.convert:DEBUG" for complete traceback

    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

odoo.tools.convert.ParseError: while parsing None:7

Erreur lors du parsing ou de la validation de la vue :


L'élément '<xpath expr="//ul[@id=&#39;top_menu&#39;]">' ne peut être localisé dans la vue parente


View error context:

{'file': '/mnt/extra-addons/visit_veone/views/visit_veone_custom_menu.xml',

'line': 1,

'name': 'Ajouter lien visite (desktop)',

'view': ir.ui.view(1436,),

'view.model': False,

'view.parent': ir.ui.view(611,),

'xmlid': 'visit_veone_menu_item'}



The above server error caused the following client error:

RPC_ERROR: Odoo Server Error

    RPCError@http://localhost:8069/web/assets/eef1bc0/web.assets_web.min.js:3141:338

    makeErrorFromResponse@http://localhost:8069/web/assets/eef1bc0/web.assets_web.min.js:3144:163

    rpc._rpc/promise</<@http://localhost:8069/web/assets/eef1bc0/web.assets_web.min.js:3149:34

   "

Avatar
Opusti

Have you tried to implement the new menu with studio?

Please share visit_veone/views/visit_veone_custom_menu.xml as this results in an error according to your post.

Best Answer

Hii,

Find the Correct Parent Template

The top menu is usually part of:

<template id = "website.layout" ... >

So you want to inherit from that.

Create Your XML View

Here's a working example that injects a link into the top menu bar:

<!-- File: visit_veone/views/visit_veone_custom_menu.xml --> <odoo> <template id = "visit_veone_menu_item" inherit_id = "website.layout"> <xpath expr = "//header//nav//ul[contains(@class, 'o_menu_sections')]" position = "inside"> <li class = "nav-item"> <a class = "nav-link" href = "/my-custom-url" >Visit Page </a> </li> </xpath> </template> </ odoo >

This will add a new top menu link to /my-custom-url .

Include It in Your Manifest

Make sure visit_veone_custom_menu.xml is loaded in your __manifest__.py :

'data' : [ 'views/visit_veone_custom_menu.xml' , ],

How to Avoid "Element Not Found" XPath Errors
Tips:
  • Inspect the rendered HTML in the browser , and search for the element (eg, ul.o_menu_sections ) to confirm it exists.
  • Do not guess IDs like top_menu unless you see them explicitly in the template. Odoo's website uses classes more than IDs.

i hope it is usefull

Avatar
Opusti
Avtor

Thanks ! It works properly rights now.

Related Posts Odgovori Prikazi Aktivnost
3
dec. 21
6892
0
dec. 18
2407
7
okt. 18
22049
2
nov. 17
6267
0
apr. 17
2527