Calling onchange methods on the server side
The Creating new records and Updating values of a recordset record recipes in Chapter 6,Basic Server-Side Development, mentioned that these operations did not call onchange
methods automatically. Yet, in a number of cases, it is important that these operations are called, because they update important fields in the created or updated record. Of course, you can do the required computation yourself, but this is not always possible as the onchange
method can be added or modified by a third-party addon module installed on the instance that you don't know about.
This recipe explains how to call the onchange
methods on a record by manually playing the onchange
method before creating a record.
Getting ready
We will reuse the settings from the Write onchange methods recipe. The action will take place in a new method of library.member
called return_all_books(self)
.
How to do it...
In this recipe, we will manually create a record of the library.returns.wizard...