HOW TO CREATE DIFFERENT TYPES OF VIEWS IN ODOO

HARSHAD
February 14, 2022

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:

The 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 the scaffold. Then we have to create the py and XML document for the requirement.

First, 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 the 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 views in the order in which we wish to display them in the view mode.

view mode

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

Thus we’ve created py and XML documents. We need to add the name of the py file in init, the 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:

student form view

This is the student from view. As given, there were two fields. The name field appears blue, 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 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 look at how it will appear.

created a tree view

Kanban view:

Here the fields are given inside the templates. First, let us look at the way we created the kanban view type.

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 look at how it appears on the screen.

kanban box

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

Graph view:

Graph view

In this view, the use of graphs represents details in the record. 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 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:

The 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 that 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, and use it but don’t have time, resources, or knowledge to manage this yourself, looking for professional help, then you have come to the right place. Bassam Infotech has implemented scores of Odoo ERPs 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 at +91 88912 49995 or +91 70250 75566 or email us at info@bassaminfotech.com

"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 *