Enable Dark Mode!
By: Athul K

List View Parameters in Odoo 16

Technical Odoo 16

Views define how records are presented to end users. You can make your modules more user-friendly by using views. Odoo consists of multiple views such as Kanban, Forms, Charts, Tree, Pivot, Search, and Calendar.

In this blog, you will learn how to create a list view and perform various operations on it.

For example, let's create the model Book.Book.

class Book(models.Model):
_name = "book.book"
      _description = "Book"
name = fields.Char(string='Name', required=True)
price = fields.Integer(string="Price")
author = fields.Char(string="Author")
category = fields.Char(string='Category')
Define the records to display the list view as shown below:
<record id="view_book" model="ir.actions.act_window">
    <field name="name">Books</field>
    <field name="type">ir.actions.act_window</field>
    <field name="res_model">book.book</field>
    <field name="view_mode">tree,form</field>
    <field name="domain">[]</field>
    <field name="help" type="html">
        <p class="o_view_nocontent_smiling_face">
            Create Books

List the fields in the list view:

<record id="view_book_tree" model="ir.ui.view">
    <field name="name">book.book.tree</field>
    <field name="model">book.book</field>
    <field name="arch" type="xml">
        <tree string="Books">
            <field name="name"/>
            <field name="author"/>
            <field name="category"/>
            <field name="price"/>

List view is shown below:


You can assign different colors to list view data.

<tree string="Books" decoration-danger="category == 'Tragedy'" decoration-success=" category == 'Novel'">


Decorators for adding different colors:

decoration-it – ITALICS
decoration-bf – BOLD
decoration-danger – LIGHT RED
decoration-primary – LIGHT PURPLE
decoration-info – LIGHT BLUE
decoration-warning – LIGHT BROWN
decoration-muted – LIGHT GRAY
decoration-success – LIGHT GREEN

1) editable: Used to make a list view editable

Example: <tree string="Student" editable="top">


2) limit: Limiting the number of records in the list view

Example: <tree string="name" limit="50">

3) delete: Disables the action of deleting

Example: <tree string="Student" delete="false">

4) create: Disables the creation of a new record

Example: <tree string="Student" create="0">

5) edit: Declines the option to edit the list view

Example: <tree string="Student" edit="0">

In summary, ListView is one of the best views available in the Odoo platform, giving users good insight into all operational menus and can be configured as needed based on company operational parameters.

If you need any assistance in odoo, we are online, please chat with us.


Leave a comment




Cybrosys Technologies Pvt. Ltd.
Neospace, Kinfra Techno Park
Kakkancherry, Calicut
Kerala, India - 673635



Cybrosys Technologies Pvt. Ltd.
1st Floor, Thapasya Building,
Infopark, Kakkanad,
Kochi, India - 682030.



Cybrosys Techno Solutions
The Estate, 8th Floor,
Dickenson Road,
Bangalore, India - 560042

Send Us A Message