Define onchange methods

When writing Odoo models, it is often the case that some fields are interrelated. We have seen how to specify constraints between fields in the Add constraint validations to a Model recipe in Chapter 4, Application Models. This recipe illustrates a slightly different concept—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 preceding recipe, Write a wizard to guide the user, but which can be used to record loan returns. When the member is set on the wizard, the list of books is updated to the books currently borrowed by the member. ...

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.