MenuItem In Odoo 14

Menu Item In Odoo

Odoo has a flexible way to define menu, sub-menu, and actions. The main attraction is that one can create a menu and sub menu from code as well as UI, which makes Odoo more user-friendly. A user can directly create a menu and sub-menu from the UI.

Here you can create Main  Menu  for enzapps.estimate model.

You can create Menu for specific actions,

In that you can create one action record Like this:

Syntax as Follows:

<record id="record action" model="ir.actions.act_window">
     <field name="name">Any Name</field>
     <field name="res_model">your.model name</field>
     <field name="view_mode">tree,form</field>
     <field name="help" type="html">
         <p class="oe_view_nocontent_create">
             No contract available
         </p>
     </field>
 </record>

Here you can add <Menuitem> like this
<menuitem id="you can add one id"
          name="mension any name"
          sequence="1"
          action="enzapps_contact_action"/> This action will be above record action
Practical case:

<record id="enzapps_contact_action" model="ir.actions.act_window">
     <field name="name">Estimate Order</field>
     <field name="res_model">enzapps.estimate</field>
     <field name="view_mode">tree,form</field>
     <field name="help" type="html">
         <p class="oe_view_nocontent_create">
             No contract available
         </p>
     </field>
 </record>
<menuitem id="enzapps_contract"
          name="Enzapps Contract"
          sequence="1"
          action="enzapps_contact_action"/>

Shows Like this

In the case of Rootmenu

first you can add the action and  and then menu item, here extra one field is mandatory “parent

syntax as follows:

<record id=”record action” model=”ir.actions.act_window”>
<field name=”name”>Any Name</field>
<field name=”res_model”>your.model name</field>
field name=”view_mode”>tree,form</field>
<field name=”help” type=”html”>
<p class=”oe_view_nocontent_create”>
No contract available
</p>
</field>
</record>

<menuitem id=”you can add one id”
name=”mension any name”

parent=” parent menu id”  Means where you want the menu  that id you can mension
sequence=”1″
action=”enzapps_contact_action”/> This action will be above record action

Note: change each menuitem id and name while creating new menus,Give proper parent id as u required

Practical case as follows.

<record id="enzapps_contact_test_action" model="ir.actions.act_window">
        <field name="name">Estimate Order</field>
        <field name="res_model">estimate.contract</field>
        <field name="view_mode">tree,form</field>
        <field name="help" type="html">
            <p class="oe_view_nocontent_create">
                No contract available
            </p>
        </field>
    </record>
<!--    To show menu-->
    <menuitem id="enzapps_contract"
              name="Enzapps Contract"
              sequence="1"/>
 
    <menuitem id="enzapps_contract_new"
              name="Enzapps Contract new"
              parent="enzapps_contract"/>
 
    <menuitem id="enzapps_contract_new_first"
              name="Enzapps Contract new first"
              parent="enzapps_contract_new"
              action="enzapps_contact_test_action"/>
    <menuitem id="enzapps_contract_new_second"
              name="Enzapps Contract new second"
              parent="enzapps_contract_new"
              action="enzapps_contact_test_action"/>

Output will be like this

 

 

 

 

To know more about us

 


 

Leave a Reply

Your email address will not be published.