-
Book Overview & Buying
-
Table Of Contents
-
Feedback & Rating
Odoo 14 Development Cookbook - Fourth Edition
By :
The context is part of the environment of a recordset. It is used to pass extra information such as the time zone and the language of the user from the user interface. You can also use the context to pass the parameters specified in the actions. A number of methods in the standard Odoo add-ons use the context to adapt their business logic based on these context values. It is sometimes necessary to modify the context on a recordset to get the desired results from a method call or the desired value for a computed field.
This recipe will show how to change the behavior of a method based on values in the environmental context.
For this recipe, we will use the my_library module from the previous recipe. On the form view of the library.book.rent model, we will add a button to mark the book as lost, in case a normal user loses a book. Note that we already have the same button in the form view of the book, but here, we will have...