Creating Views

We have created the Books model and made it available in the user interface with a Menu Item. Next, we will be creating the two essential views for it: a list (also called a tree) and a form.

In Settings, navigate to Technical | User Interface | Views and create a new record with the following values:

  • View Name: Books List View
  • View Type: Tree
  • Model: x_library_book

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_author_ids" widget="many2many_tags" /></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 added the ...

Get Odoo 11 Development Essentials - Third Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.