Enable Dark Mode!
list-view-parameters-in-odoo-15.jpg
By: Athul K

List View Parameters in Odoo 15

Technical Odoo 15

Views are what define how records should be displayed to end-users. We can make modules more user-friendly by using the views. Odoo consists of several views such as Kanban, form, graph, tree, pivot, search, and calendar.

Through this blog, let us see how to create a list view and execute various operations on the list view.

For example, let us create a model ‘student.student’.

class Student(models.Model):
_name = "student.student"
_description = "Student"
name = fields.Char(string='Name', required=True)
age = fields.Integer(string="Age")
standard = fields.Char(string="Class")
mobile = fields.Char(string='Mobile', required=True)
Father_name = fields.Char(string='Father name')

Now define a record to view the list view as shown below:

<record id="view_student" model="ir.actions.act_window">
   <field name="name">Student</field>
   <field name="type">ir.actions.act_window</field>
   <field name="res_model">student.student</field>
   <field name="view_mode">tree,form</field>
   <field name="help" type="html">
       <p class="o_view_nocontent_smiling_face">
           Create Student
       </p>
   </field>
</record>

List the fields in the list view:

<record id="view_student_tree" model="ir.ui.view">
   <field name="name">student.student.tree</field>
   <field name="model">student.student</field>
   <field name="arch" type="xml">
       <tree string="Students">
           <field name="name"/>
           <field name="age"/>
           <field name="standard"/>
           <field name="mobile"/>
           <field name="Father_name"/>
       </tree>
   </field>
</record>

The list view is shown below:

list-view-parameters-in-odoo-15-cybrosys

We can set various colours to the list-view data.

<tree string="Students" decoration-danger="standard == 'plus one'" decoration-success=" standard == 'plus two'">

list-view-parameters-in-odoo-15-cybrosys

Decorators for adding different colours:

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

list-view-parameters-in-odoo-15-cybrosys

2) limit: Limiting a 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 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 conclusion, the ListView is one of the best views available in the Odoo platform providing the user's with the proper insight available in all the menus of operation and can be configured based on the opertsional parameters of the business as per the need.


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



0
Comments



Leave a comment



whatsapp_icon
location

Calicut

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

location

Kochi

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

location

Bangalore

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

Send Us A Message