The following decorators are also frequently used. They are related to the internal behavior of a model and are discussed in detail in Chapter 6, Models - Structuring the Application Data.
We mention them here for your reference:
- @api.depends(fld1,...) is used for computed field functions to identify on what changes the (re)calculation should be triggered. It must set values on the computed fields, otherwise it will error.
- @api.constrains(fld1,...) is used for model validation functions and performs checks for when any of the mentioned fields are changed. It should not write changes in the data. If the checks fail, an exception should be raised.