Defining onchange methods

When writing Odoo models, it is often the case that some fields are interrelated. We looked at how to specify constraints between fields in the Adding constraint validations to a model recipe in Chapter 5, Application Models. This recipe illustrates a slightly different concept. Here, onchange methods are called when a field is modified in the user interface to update the values of other fields of the record in the web client, usually in a form view.

We will illustrate this by providing a wizard similar to the one defined in the Writing a wizard to guide the user recipe, but that can be used to record book returns. When a member is set in the wizard, the list of books is updated to the books that are currently borrowed by the member. While we are demonstrating onchange methods on a TransientModel, these features are also available on normal Models.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset