Adding computed fields to a model

Sometimes, we need to have a field that has a value calculated or derived from other fields in the same record or in related records. A typical example is the total amount, which is calculated by multiplying a unit price by a quantity. In Odoo models, this can be achieved using computed fields.

To show you how computed fields work, we will add one to the Library Books model to calculate the days since the book's release date.

It is also possible to make computed fields editable and searchable. We will implement this in our example, as well.

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

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