How to Create a tree viewHow to Create a tree view

Greetings Everyone,

In this blog-post, you will learn how to create a Tree View in an Odoo 8 module.

What is Tree View in Odoo?

  • Tree View also known as List View shows multiple records in the form of a list (rows and columns).
  • Each row represents a record of the database table.
  • Tree View is used to show important data, i.e only some important columns of the model/table.
  • You can do various operations on Tree view that is sorting, filter and group by.

 

Example of a Tree View :-

Earlier in my previous blog-post, I had created a Model to collect student’s information. Then I had created its From View. Now I will create a Tree View for the student model.

Code for creating a Tree View:

<!-- Tree View for Student Information -->
		<record id="student_tree_view" model="ir.ui.view">
			<field name="name">student.tree.view</field>
			<field name="model">student.student</field>
			<field name= "arch" type = "xml">
				<tree string="Student Information">
					<field name="name"/>
					<field name="email"/>
			 		<field name="contact"/>
			 		<field name="dob"/>
			 		<field name="course_id"/>
				</tree>
			</field>
		</record>

Steps for creating Tree View in Odoo:

  • All views are stored in the database, in the ir.model.view model. To add a view in a module, we declare an <record> element describing the view in an XML file that will be loaded into the database when the module is installed.
  • The root element of a Tree View is <tree>
  • Now inside tree tag define all the important fields that you want to add to the tree view.

SnapShot of Eclipse IDE:-

tree view odoo module
Tree view odoo module – Click to enlarge
tree view odoo module
tree view odoo module – Click to enlarge

Hope you learnt how to create a Tree View in Odoo module, your reviews/comments/suggestions/doubts are most welcomed, please comment in the section below, and subscribe to the newsletter to receive timely future updates of this blog.

Further, Learn how to create an Action and its Menuitem in Odoo 8.

Thank You

By Burhan Vakharia

Having 6+ years of experience working on Odoo with projects covering several business verticles like Retail industry, Manufacturing, Service, Rental, Education, Medical and many more. I am having experience working on Odoo projects from several countries across the globe.

2 thoughts on “Learn – How to create a Tree View in Odoo 8 with Example”
  1. NEW Music

    Techno, Tech House, Minimal: https://techno-summer.blogspot.com
    RNB,Promo Only,Albums: https://classicalrnb.blogspot.com
    Music Scene Label Records: https://scenelabels.blogspot.com/
    0day Trance: https://trance2019.blogspot.com/
    Old School Music, Industrial: https://electro1990.blogspot.com/
    Reggae FLAC: https://reggaenfo.blogspot.com
    Music Metal Albums: https://deatmetalmaniac.blogspot.com
    0day Music Releases: https://0dayzmp3.blogspot.com
    FTP service is a community for DJ’s & fans that helps you gain full access to exclusive electronic music. Main target of our service is to show the world new upcoming talents as well as famous producers, populations of music culture, promotion of perspective projects.

    Best Regards, Francis

Leave a Reply

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