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 ...
Get Odoo Development Cookbook 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.