Wizard in Odoo 15 | How to Generate the wizard in Odoo | Odoo Wizard
News & Events Quick Tips


Wizard In Odoo

Wizards are used for interacting in Odoo. In Odoo, wizards are of two types. They are:

  1. Transient Model
  2. Abstract Model 

Transient Model:

It is based on the transient model class. The data stored in the database is temporary in this class which periodically clears data from the database table.

Abstract Model:

Most of the models in Odoo are based on this model class. The data stored in the table created are permanent until it is deleted.

Wizards are an important part of every module. Here let us take a look at how to create a simple wizard. Here in this example, I am going to generate a wizard in the reporting menu on the sale order.


This is the wizard of the Product Summary Report in which Product and Sales Person are added. Here we give the Many2one field for the product and Many2many for the salesperson. So when we click on the Print button, an excel report will be generated, which includes all the details of the product and respective salesperson in the wizard.

Next, we will discuss the code used to Generate the Wizard in Odoo. For that, we have to create the py and xml.

odoo 15

Here a model is defined Product Wise Sale Report.Then added two fields

  1. User_ids, which is a Many2many field of res.users.
  2. Product_id, which is a Many2one field of product.product.

After that, define the function of button_print. That means when we click on the print button, and an excel report is generated on the basis of the data given on wizards. Then inside the function, we pass the values of the fields product_id and user_id and then return the action.

Then create an xml file like this:

create an xml file

Here give the record id, and the model is the Then inside the form, there is the main group. Inside the main group, there are another two groups. Add product_id in the first group and user_ids in the second group. Then we will add a footer. Inside the footer, add the print button.

Create report from wizard in odoo 15

Then after, the action for viewing the wizard should be included.Here the action is action_view_product_wise_sale_report_wizard.Then give the menu item id for displaying the report menu. Give the parent that means the place where the report should be put.

When we give the menu item id, it works like this:

odoo wizard

Here we can see the product-wise sale report in the Reporting menu.


We can upload and import files through the wizard. Let us see how this can be done.

First of all, take a look at the code in the py file.

class YourWizard(models.TransientModel):

_name = 'your_wizard'

# your file will be stored here:

csv_file = fields.Binary(string='Upload your File',


@api.multi def import_csv(self):

# this will get executed when you click the import button in your form return {}

Here a csv_file is declared. This is a field for uploading your file. This field is set as required, which means it needs to be filled. After that, a function is defined as import_csv. This is the function for importing the file that we have already uploaded in the wizard. So when we click on the import button, the uploaded file is imported.

Next we are going to see the xml file for this:



<record id="your_wizard_form" model="ir.ui.view">

<field name="name">your.wizard.form</field>

<field name="model">your_wizard</field>

<field name="arch" type="xml">

<form string="Import a csv file">

<group name="main">

<field name="csv_file" />



<button name="import_csv" type="object" string="Import" class="oe_highlight"/>

<button special="cancel" string="Cancel"/>





<record id="your_wizard_action" model="ir.actions.act_window">

<field name="name">Import a csv file</field> <field name="res_model"your_wizard</field>

<field name="view_mode">form</field>

<field name="target">new</field>


<menuitem id="your_wizard_menu parent="SOME_MENU_IN_PURCHASE” action="your_wizard_action" sequence="15" /> </data>



Inside the form, there will be a group, and the field csv_file is declared inside the main group. Inside the footer tag, a button import is added, and also a cancel button is added. The action for the wizard in odoo is given above, and the menu item is also added.

If you plan a new ERP Software implementation and you have heard about Odoo and got attracted by the Odoo ERP platform, decided to use it but don’t have time, resources, or knowledge to manage this yourself, thereby looking for professional assistance, then you have come to a right place. Bassam Infotech has implemented scores of Odoo ERP all around the world. In addition, we have also developed and delivered our own customized Odoo applications with minimal Odoo implementation cost.


Bassam Infotech is a company of Official Odoo Certified Experts with 24 years of expertise. We are a one-stop shop for all your business needs, including Odoo Implementation, customization, integration, and support. We’re available by phone or email, with a 24-hour response time in case you need immediate Odoo ERP support. For more details, Call us on +91 88912 49995 or +91 70250 75566 email us at or fill out the form to get a free consultation

Leave a Reply

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

Open chat
Hello, can we help you?