Calling onchange methods on the server side
The onchange
method has a limitation: it will not be invoked when you are performing operations on the server side. onchange
is only invoked automatically when the dependent operations are performed through the Odoo user interface. Yet, in several cases, these onchange
methods must be 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 since the onchange
method can be added or modified by a third-party add-on module that’s been installed on the instance that you don’t know about.
This recipe explains how to call the onchange
methods on a record by manually invoking the onchange
method before creating a record.
Getting ready
In the Changing the user that performs an action recipe, we added a Return Room button so that users can update the room and hostel by themselves. We now want to do the same for returning...