Menu & Action

  • Step 1:

    1. create menu

    
                  <odoo>
      <data>
       
    
        <!-- Top menu item -->
        <menuitem name="school" id="school.menu_root"/>
    
    
        <!-- menu categories -->
        <menuitem name="Activity" id="school.menu_1" parent="school.menu_root"/>
        <menuitem name="Masters" id="school.menu_2" parent="school.menu_root"/>
    
    
    
        <!-- actions -->
        <menuitem name="Teacher" id="school.menu_1_list" parent="school.menu_1"
                  action=""/>
                  
        <menuitem name="Student" id="school" parent="school.menu_2"
                  action=""/>
    
      </data>
    </odoo>
    
          

    2. Create window action

    1. id for linking the window and menu

    2. res_model for populating default form fields

    3. view_mode for form

    
    
              <!-- actions opening views on models -->
    
        <record model="ir.actions.act_window" id="school.action_window">
          <field name="name">school window</field>
          <field name="res_model">school.school</field>
          <field name="view_mode">tree,form</field>
        </record>
    
    
    
    
          
    1. id="school.action_window" for menu linking
    2. res_model">school.school is model name in models/school.py

    3. link the menu and action

    add menu action and set action window id

    
          <menuitem name="List" id="school.menu_1_list" parent="school.menu_1"
                  action="school.action_window"/>