2025-07-22

TIL: Odoo 18 Default Action with Nice URL#

We have a dashboard that references actions of multiple addons in a single place to make navigation easier.

The first menuitem is the default action. It is important to have a custom action. Else Odoo will open the existing dashboard. Instead, create a new action and copy its contents, e.g. for project.open_view_project_all_group_stage:

<record id="custom_dashboard_projects" model="ir.actions.act_window">
    <field name="name">Projects</field>
    <field name="path">custom</field>
    <field name="res_model">project.project</field>
    <field name="context">{'display_milestone_deadline': True}</field>
    <field name="domain">[]</field>
    <field name="view_mode">kanban,list,form,calendar,activity</field>
    <field name="view_id" ref="project.view_project_kanban"/>
    <field name="search_view_id" ref="project.view_project_project_filter"/>
    <field name="target">main</field>
    <field name="help" type="html">
        <p class="o_view_nocontent_smiling_face">
            No projects found. Let's create one!
        </p>
        <p>
            Projects contain tasks on the same topic, and each has its own dashboard.
        </p>
    </field>
</record>

Note the path field. It allows us to make a pretty URL, e.g. /odoo/custom.

I find it unfortunate that one cannot inherit from an action as one can from a view, but that’s just Odoo. 🙄

Thanks to Odoo 18 New Short URL | Say goodbye to long links! - YouTube!