Odoo Help


v8 How to decorate Computed fields methods depending on relation ?

Emanuel Cino
on 8/4/15, 6:03 AM 685 views

Let's say a computed field depends on a relation, like this:

event_year = fields.Date(compute='_get_event_year', store=True)

fiscal_years = fields.One2many('account.fiscal.year')

def _get_event_year(self):

Is it ok to depend only on field fiscal_years, i.e. will the year will be changed anytime one dependent fiscal_year is updated or should we specify each field on the relation we wan't to listen to like for instance 'fiscal_years.year' ? If we would listen to several fields like ('fiscal_years.year', 'fiscal_years.month', ...) can we just keep 'fiscal_years' in the depends decorator or should we list all sub_fields ? 

About This Community

This platform is for beginners and experts willing to share their Odoo knowledge. It's not a forum to discuss ideas, but a knowledge base of questions and their answers.


Odoo Training Center

Access to our E-learning platform and experience all Odoo Apps through learning videos, exercises and Quizz.

Test it now

Question tools

1 follower(s)


Asked: 8/4/15, 6:03 AM
Seen: 685 times
Last updated: 8/4/15, 6:03 AM