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

Extending views


Forms, lists, and search views are defined using the arch XML structures. To extend views we need a way to modify this XML. This means locating XML elements and then introducing modifications on those points.

Inherited views allow just that. An inherited view looks like this:

<record id="view_form_todo_task_inherited" model="ir.ui.view">
  <field name="name">Todo Task form – User extension</field>
  <field name="model">todo.task</field>
  <field name="inherit_id" ref="todo_app.view_form_todo_task"/>
  <field name="arch" type="xml">
      <!-- ...match and extend elements here! ... -->
  </field
</record>

The inherit_id field identifies the view to be extended, by referring to its external identifier using the special ref attribute. External identifiers will be discussed in more detail in Chapter 4, Data Serialization and Module Data.

The natural way to locate elements in XML is to use XPath expressions. For example, taking...