In Odoo, computed fields are widely used for computing values of certain fields. By default, such fields are considered read-only. While this allows ensuring consistency of data, sometimes this could be restrictive. There are some instances in real-life businesses when it’s necessary to edit a certain computed value without losing the ability to perform automatic calculations.
In today’s blog post, we will talk about Odoo computed fields in version 19 and explore the possibilities of making them editable with the help of store=True, inverse methods, and proper configurations.
A computed field represents a field value that should be calculated through the Python logic rather than set manually. Computed fields are created using the ‘compute’ attribute and, in most cases, are dependent on other fields through the @api.depends decorator.
Computed fields in Odoo are considered to be values controlled by the system. As a result, manual data entry is impossible because Odoo does not know how to handle them.
Without any further logic being specified, any manually typed values will be lost on subsequent calculations of the field.
This is where the inverse function comes in, to let Odoo know what it should do with user input.
cost = fields.Float(string="Custom Cost")
price = fields.Float(string="Custom Price")
margin = fields.Float(
string="Custom Margin", compute="_compute_margin",
inverse="_inverse_margin", store=True, readonly=False)
@api.depends('cost', 'price')
def _compute_margin(self):
for order in self:
order.margin = order.price - order.cost
def _inverse_margin(self):
for order in self:
# When user edits margin, recompute price
order.price = order.cost + order.margin
In the above example, the margin is automatically calculated from custom cost and price fields, while still allowing users to manually edit the margin when required.
Here,
- cost - User-entered cost
- price - User-entered selling price
- margin - Computed value derived from cost and price
The margin field is computed but explicitly made editable. @api.depends('cost', 'price') tells Odoo when to recompute the margin. Whenever cost or price changes, Odoo recalculates the margin.
margin = price - cost
The inverse method is triggered when the user edits the margin field. It tells Odoo how to save the user’s input.
In this case:
price = cost + margin
Without this method, Odoo would ignore or overwrite user edits.
Runtime behaviour:
- Change cost: Margin recalculates automatically
- Change price: Margin recalculates automatically
- Edit Margin: Price updates automatically

In the above image, I updated the custom cost and price to 10.00 and 100.00, respectively, and it updated the value of margin automatically to 90.00.

Here, I have updated the margin to 40.00, and then the price is automatically updated to 50.00.
This example demonstrates the correct and recommended way to implement an editable computed field in Odoo 19 using only custom fields.
Editable computed fields are useful when you need both automation and flexibility. By adding store=True and defining an inverse method, you allow users to override values without breaking the computation logic. The key is to ensure that both compute and inverse methods are aligned. This way, the system stays consistent whether values are updated automatically or manually.
To read more about How to Create Computed Fields in Odoo 18, refer to our blog How to Create Computed Fields in Odoo 18.