Search Here

Create Form and Tree (List) View in Odoo13

 In this article, you will learn how to create a new form and tree view in Odoo13. Till now we have created Menu and Window Action and a brand new model from scratch. To display records to the end-user we have to create views.

Create Form and Tree (List) View in Odoo13

Views in Odoo

Like the older version of Odoo, Odoo13 also has different types of views, like form, tree or list, search, and the kanban view. In this article, I am going to create a new form and tree view for our model which I have created in my previous article. Remember by default Odoo creates form and tree view only for the name field, If you want to show all of your fields (including One2many, Many2one, and Many2many) we have to create views.

Recommend:

How to Create Form and Tree View in Odoo8

How to Create Form and Tree View in Odoo13

To create views follow the below steps.

  1. Open the views.xml file under your_module >> views directory and copy the below code and paste it. Don't forget to paste that code above window action. The reason is adding view code above the window action or menu item is, whenever we upgrade the module it upgrades window action first than views.
  2. Register your xml file (views.xml) in __manifest.py__.
  3. Whenever we have changed in the XML file, we need to upgrade the module to implement that change.


Field Description
model ir.ui.view (All of your views are created in this table)
id Unique id of your view (Preffered: view_your_model_name_form | view_your_model_name_tree)
name Give any name of your view (Preffered: your.model.name.form | your.model.name.tree)
model Model name goes here (your.model.name)
type Type of your view, In case of form it would be form, in case of tree it would be tree form

Post a Comment

0 Comments