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

Modifying data


Unlike views, regular data records don't have an XML arch structure and can't be extended using XPath expressions. But they can still be modified to replace values in their fields.

The <record id="x" model="y"> element is actually performing an insert or update operation on the model: if x does not exist, it is created; otherwise, it is updated/written over.

Since records in other modules can be accessed using a <model>.<identifier> identifier, it's perfectly legal for our module to overwrite something that was written before by another module.

Note

Note that the dot is reserved to separate the module name from the object identifier, so they shouldn't be used in identifiers. Instead use the underscore.

As an example, let's change the menu option created by the todo_app module to into My To Do. For that we could add the following to the todo_user/todo_view.xml file:

    <!-- Modify menu item -->
    <record id="todo_app.menu_todo_task" model="ir.ui.menu...