Modifying existing fields

As you can see, adding new fields to an existing model is quite straightforward. Modifying the attributes on existing models is also as simple.

When extending a model, existing fields can be modified incrementally. This means that we just need to define the field attributes to change or add.

For example, to add a help tooltip to the name field, we would add this line to todo_task_model.py, described previously:

    name = fields.Char(help="What needs to be done?")

This modifies the field with the specified attributes, leaving all the other attributes not explicitly used here unmodified. After this, when we upgrade the module, if we go to a To-Do task form and hover the mouse pointer over the Description field, the tooltip ...

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.