How to Trigger a Custom Action from the “New” Button

Do you need to display a custom wizard or a simplified form when creating a new record?

In Odoo this can be achieved by using the on_create​ attribute.

The on_create​ attribute expects an action as its value. Importantly, the action does not need to be tied to the same model, it can trigger a custom wizard instead. The only requirement is that the action must return the newly created record for the original model.

Once set, clicking New​ will trigger your custom workflow for creating a new record.

One place where this approach is currently used in Odoo is in the Project Kanban view, where clicking New​ opens a simplified popup to create a project.

Currently, the on_create​ attribute is supported only in a few views, like Kanban and Gantt.

It would be a great if Odoo extended this functionality to other commonly used views, such as List and Form.