An Overview of the Odoo 16 Wizards and How to Manage Them

HARSHAD
March 14, 2023

To enhance the user experience, Odoo uses wizards to create interactive sessions. This type of interactive session is very beneficial for any business. The transient Model and abstract model can create a wizard. But Transient Model is mainly used for creating wizards in Odoo. This gives all the features of the Model except A transient model stores data temporarily and periodically deletes it.

Wizards extend the class Transient Model instead of models and below is the specification

  1. Eventually, wizard data are automatically removed from the database; they are not permanent.
  2. Through many2one fields, wizard records may refer to regular data or wizard data, but regular data cannot refer to wizard data.
  3. Wizard data is accessible to all users

First, we need to create a directory named wizard on your module, then inside this module, create a python file for a wizard and create a transient model class as shown below.

odoo-wizard-creation

Next, we need to create a view for this wizard. Wizards are always open as ir. Actions.act_window data. Here we can start the wizard action by using the menu item we can also use the button action. So, here when we click the menu item this will open a wizard, so we can create a menu item.

Request Your Free Quote
create-a-menu-item

Next, we can add actions for this menu,

add-actions-for-this-menu

res_model: on which model this action will be performed

we want to give the ‘id’ given in this action to ‘action’ in the menu item.

Here we give view_mode as form, so we need to create a view for this wizard. The following code can be used to accomplish that.

create-a-view-for-this-odoo-wizard

On the view, we can specify the model, and inside the form tag, we can give whatever field we need to show in the wizard.

Also, the default footer will be ok, if we need to add any button, we can add it in the footer tag. Inside the form tag and after the closing group tag.

we-can-add-it-in-the-footer-tag

Here we need to define the action_done button in the py file. This is how we can create a wizard in Odoo 16.

DOWNLOAD ERP

"Unlock the Full Potential of Your Business with Odoo ERP!"

"Get a Cost Estimate for Your ERP Project, Absolutely FREE!"

Get a Free Quote

Leave a Reply

Your email address will not be published. Required fields are marked *