Odoo 12 Development Essentials
上QQ阅读APP看书,第一时间看更新

List views

We will now create a list view:

  1. In Settings, navigate to Technical | User Interface | Views and create a new record with the following values:
    • View Name: To-do List View
    • View Type: Tree
    • Model: x_todo_item

This is how the View definition is expected to look like:

  1. In the Architecture tab, we should write XML with the view structure. Use the following XML code:
<tree>
<field name="x_name" />
<field name="x_is_done" />
</tree>

The basic structure of a list view is quite simple—a <tree> element containing one or more <field> elements for each of the columns to display in the list view.

We can do a few more interesting things with list views, and will explore them in more detail in Chapter 10, Backend Views – Design the User Interface.