This question has been flagged
4 Replies
18388 Views

In odoo12 enterprise edition, I created a module, its all submenus are added to the top menu but not their parent menu.

In my code, first, I added the outsourcing menu to the website.main_menu and some submenu to the outsourcing menu. The result is that all submenus are added to the website.main_menu.
Another problem is that after uninstalling the module, there are unremoved submenu items in the menu of the website's configuration.

The following is my code. what is the problem?

<?xml version="1.0" encoding="UTF-8"?>
<odoo>
<data noupdate="0">
<record id="main_menu" model="website.menu">
<field name="name">Outsourcing</field>
<field name="url">/outsourcing</field>
<field name="parent_id" ref="website.main_menu"/>
<field name="sequence">11</field>
</record>
<record id="issue_requirement" model="website.menu">
<field name="name">issue task</field>
<field name="url">/outsourcing/issue_task</field>
<field name="parent_id" ref="outsourcing.main_menu"/>
<field name="sequence">12</field>
</record>
</data>
</odoo>
Avatar
Discard
Best Answer

Hi,

Can you please remove the  URL from the first record and try once more.

<record id="main_menu" model="website.menu">
<field name="name">Outsourcing</field>
<field name="parent_id" ref="website.main_menu"/>
<field name="sequence">11</field>
</record>



See the Below sample we have tried,

<record id="menu_shop" model="website.menu">
<field name="name">Shop</field>
<field name="parent_id" ref="website.main_menu"/>
<field name="sequence" type="int">20</field>
</record>
<record id="menu_test_shop" model="website.menu">
<field name="name">Sub Menu</field>
<field name="url">/shop</field>
<field name="parent_id" ref="menu_shop"/>
<field name="sequence" type="int">20</field>
</record>


Result:


Thanks

Avatar
Discard
Best Answer

did you find the solution? I have the same problem with odoo 14

Avatar
Discard
Best Answer

You can try like this,

add one more field "website_id"

<record id="menu_shop" model="website.menu">
<field name="name">Shop</field>
<field name="parent_id" ref="website.main_menu"/>
<field name="sequence" type="int">20</field>
<field name="website_id" ref="website.default_website"/>
</record>
Avatar
Discard
Author Best Answer

Cybrosys Techno Solutions Pvt.Ltd:

Thank you very much, because I can't comment on your post, it needs at least 300 karmas. So I post on here.

I tried your suggestion, but the problem is still there. I read the code, I think it is a bug. I filed an issue on odoo github.  https://github.com/odoo/odoo/issues/30783

Avatar
Discard