O'Reilly logo

Odoo Development Cookbook by Daniel Reis, Alexandre Fayolle, Holger Brunn

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Extending write() and create()

The Extending the business logic defined in a Model recipe showed how to extend methods defined on a model class. If you think about it, methods defined on the parent class of the model are also part of the model. This means that all the base methods defined on models.Model (actually on models.BaseModel, which is the parent class of models.Model) are also available and can be extended.

This recipe shows how to extend create() and write() to control access to some fields of the records.

Getting ready

We will extend on the library example from the my_module addon module in Chapter 3, Creating Odoo Modules.

You will also need the security groups defined in Chapter 10, Accessing Security in the Creating security Groups ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required