Call onchange methods on the server side

The Create new records and Update values of a recordset record recipes in Chapter 5, 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 ...

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.