On change events
The on change mechanism allows us to change values in other form fields when a particular field is changed. For example, the on change on a Product field can set the Price field to a default value whenever the product is changed.
In older versions, the on change events were defined at the view level, but since Version 8.0 they have been defined directly on the Model layer, without the need for any specific markup on the views. This is done by creating methods to perform the calculations, and by using @api.onchange('field1', 'field2') to bind it to fields. The on change methods are discussed in more detail in Chapter 6, The ORM API – Handling Application Data.
The on change mechanism also takes care of the automatic recomputation ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access