Actions & menus

Actions tell the client what to open; menus put actions in the navigation.

A window action

<record id="my_lead_action" model="ir.actions.act_window">
  <field name="name">Leads</field>
  <field name="res_model">my.lead</field>
  <field name="view_mode">list,form</field>
</record>
<menuitem id="my_app_root" name="My App" sequence="10"/>
<menuitem id="my_lead_menu" parent="my_app_root"
          action="my_lead_action" sequence="1"/>

A top-level menuitem with no parent becomes an app in the app menu. Children appear in that app's sidebar.

Client actions

For a fully custom screen, register an OWL component as a client action and point an ir.actions.client at its tag. See The web framework.

Web controllers

To expose an HTTP or RPC endpoint, add a controller:

from odoo import http
from odoo.http import request

class MyController(http.Controller):
    @http.route("/my_app/ping", type="jsonrpc", auth="user")
    def ping(self):
        return {"ok": True}

Version 19 note

Use type="jsonrpc" (or type="http"). The older type="json" is gone.

Need a hand with this? company@everjust.co — a human answers.