blog

How to create different types of Views in Odoo | Five View Types in Odoo
News & Events Quick Tips

HOW TO CREATE DIFFERENT TYPES OF VIEWS IN ODOO

There are distinctive varieties of view types in odoo. They are:

  1. Form view 
  2. Tree view
  3. Kanban view
  4. Graph view
  5. Pivot view

Form view:

Form view type is one of the major view types in Odoo. Forms play an important part and are mainly used for inputting some records into certain fields and showing the information of a few specific persons or employers or products.

Let us create a form view of students:

odoo form view

Here we need to create a module “bi_school” using scaffold. Then we have to create the py and xml document for the requirement.

First of all, we are creating a py file named student.py on this screenshot. Here we should outline the class ‘Student’ and model of the class’ student.student’. Then we have to define the fields inside the class.Here two fields were declared. They were: name and age.

The name should be in the character field, and age also should be in the character field. Then we declare the name field as required. That means the field must be filled.

Next, we should create an xml file for this student form.

student form

Here we need to add the name of the model as given in the py file to display the form view. Then inside the first group, add the two fields required.

Then give the action for viewing the form view. We have to list the types of view in the order in which we wish to display it in the view mode.

view mode

Also, add the menu item to the form. School is given as the parent menu for student.

Thus we’ve created py and xml documents. We need to add the name of the py file in init, model name in the security, and xml files and security in the manifest. Add the xml files in the views. For example, ‘views/student.xml’

In case of inheriting any model from the base, we have to add dependencies also in the manifest.

Then after that, we have to install the module and run it. Then it will appear as follows:

student form view

This is the student form view. As given, there were two fields. The name field appears blue in color, which we gave as required. That means the field must be filled.

Tree view:

Another one of the view types is a tree. Let us take a look at the manner it is created:

view types is a tree

Fields are entered the same as in the form view, but it has to be entered inside the <tree>.

We created a tree view for the form in the xml file. Let’s take a look at how it will appear.

created a tree view

Kanban view:

Here the fields are given inside the templates. First, let us take a look on the way the kanban view type is created.

Kanban view

Here each record is displayed in a kanban box. So here in the xml file, a kanban-box is used. So let us take a look at how it appears on the screen.

kanban box

Records are displayed in separate boxes, and respective details of the records are also included in the boxes.

Graph view:

Graph view

In this view, details in the record are represented by the use of graphs. Field names are added like in other view types in xml. After running the code for graph view type, we get output like this:

graph view type

This is a line chart. At the top left of the chart, there display different types of charts for which it is displayed. They are:

  1. Bar chart

  2. Line chart

  3. Pie chart

  4. Stacked

  5. Descending

  6. Ascending

We could make the chart consistent with our requirements. 

Pivot view:

Pivot view is like a table containing rows and columns. Field names and values will appear in rows and columns of the table.

Pivot view

Here a separate action for the pivot view has been covered. After running the code, the output of the view kind will be:

odoo pivot view

Here we can see a table of contents. This is the pivot view. At the right end of the top of the pivot view, we can see the view types in odoo. This is in the order of which we are given in the action of the xml file.

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.

DOWNLOAD Odoo

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 info@bassaminfotech.com

Leave a Reply

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

Open chat
1
Hello, can we help you?