简体   繁体   中英

Adding menu to Odoo 10 in custom module

I want to add a submenu to Settings->Technical menu in Odoo 10. I have tried with the following code, apparently the menu item is loaded (you can see that it is one of the menus created by the custom module) but it is not displayed.

Any tip/suggestion on why?

<?xml version="1.0"?>
<odoo>
    <menuitem id="sale_order_custom_document"
              name="Sale Order Custom Documen"
              parent="base.menu_custom"
    />
</odoo>

Thanks

You have to define the action in menuitem then only it is visible. menuitem without any action will became normal string for display purpose. So either add sub menu with action or directly assign any action to it.

<menuitem name="Sale Order Custom Document" action="<your_action_id>" id="sale_order_custom_document" parent="base.menu_custom" sequence="20"/>

Here's a description link for odoo action

  1. you must also create the actions 's record named:

    product.product_template_action_custom_docs for example

  2. declare your menu just after

Try this:

<odoo>
  <data>
     <!-- your initial code in your <app>_view.xml -->
     <record id="product.product_template_action_custom_docs" model="ir.actions.act_window">
        <field name="name">Sale Order Custom Document</field>
        <field name="res_model">product.template</field>
        <field name="view_mode">tree,kanban,form</field>
        <field name="view_type">form</field>
        <field name="context">{"search_default_filter_to_sell":1}</field>
        <field name="help" type="html">
           <p> here you write the help form your form</p>
        </field>
     </record>

        <!-- after the action, you can now paste your menu declaration
        your specified "action", "id","name","sequence" and "parent"-->

       <menuitem action="product.product_template_action_custom_docs" 
        id="sale_order_custom_document"  parent="base.menu_custom" sequence="20" name="Sale Order Custom Document" />
  </data>
<odoo>

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM