
List View Attributes in Odoo 18
Overview
Odoo provides a variety of view types to present data in a way that suits different user needs, including Kanban, Form, Graph, Tree, Pivot, Search, and Calendar views. Among these, the list (or tree) view plays a crucial role in organizing and displaying records in a structured and easy-to-navigate format. This view is essential for working with large datasets, enabling users to view and manage records efficiently. In this blog, we will delve into the process of creating a list view in Odoo, explore the different attributes that can be utilized, and discuss best practices for optimizing its performance.
Attributes
String(str):
String attribute is used to provide a name for the view.
Eg: <list string="Sale Orders">
Create(bool):
Create attribute allows you to restrict creation of records in the view. By default the value is set to True.
Eg: <list string="Sale Orders" create="0">
delete(bool):
Delete attribute allows you to restrict deletion of records in the view via the Action dropdown.
Eg: <list string="Sale Orders" delete="1">
<list string="Sale Orders" delete="0">
import(bool):
Import attribute allows you to restrict importing of records in the view.
Eg: <list string="Sale Orders" import="1">
Eg: <list string="Sale Orders" import="0">
export_xlsx(bool):
Export attribute allows you to restrict exporting of records in the view.
Eg: <list string="Sale Orders" export_xlsx="1">
Eg: <list string="Sale Orders" export_xlsx="0">
editable(str):
Editable attribute allows you to edit the tree view in different ways
Top:
New records are created at the top of the list.
Eg: <list string="Sale Orders" editable="top">
Bottom:
New records are created at the bottom of the list.
Eg: <list string="Sale Orders" editable="bottom">
limit:
Using this attribute we can limit the number of records in the list view.
Eg: <list string="Sale Orders" limit="2">
default_group_by:
The attribute allows you to apply the default group by in the view based on some field.
Eg: <list string="Sale Orders" default_group_by="state">
expand:
The attribute indicates whether the group should be expanded by default when the list view is grouped.
Eg: <list string="Sale Orders" default_group_by="state" expand="1">