跳至内容
菜单
此问题已终结
3445 查看

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')

@api.depends('fiscal_years')
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 ? 

形象
丢弃
相关帖文 回复 查看 活动
2
4月 16
8065
3
8月 15
5103
1
1月 24
6478
3
7月 25
8650
1
5月 25
941