Book Image

Odoo Development Essentials

Book Image

Odoo Development Essentials

Overview of this book

Table of Contents (17 chapters)
Odoo Development Essentials
Credits
About the Author
About the Reviewers
www.PacktPub.com
Preface
Index

List views


Compared to form views, list views are much simpler. A list view can contain fields and buttons, and most of their attributes for forms are also valid here.

Here is an example of a list view for our To-do Tasks:

<record id="todo_app.view_tree_todo_task" model="ir.ui.view">
  <field name="name">To-do Task Tree</field>
  <field name="model">todo.task</field>
  <field name="arch" type="xml">
    <tree editable="bottom"
          colors="gray:is_done==True"
          fonts="italic: state!='open'" delete="false">
		  <field name="is_done" invisible="True"/>
		  <field name="stage_state" invisible="True"/>
      <field name="name"/>
      <field name="user_id"/>
    </tree>
   </field>
</record>

The attributes for the tree top element are:

  • editable: makes the records editable directly on the list view. The possible values are top and bottom, the location where new records will be added.

  • colors: dynamically...