I have this situation :
1) 'field_count' work without problem
def _count_all(self, cr, uid, ids, field_name, arg, context=None):
Obj = self.pool['class.y']
return {
x_id: Obj.search_count(cr, uid, [('x_id', '=', x_id)], context=context)
for x_id in ids
}
'field_count': fields.function(_count_all, type='integer'),
2) add domain in class y for x_id
=>problem because store=False
'x_id': fields.many2one('class.x', 'X', domain="[('field_count','>',0)]"),
3) activation of domain with adding store=True for 'field_count'
=>problem of update for 'field_count'
4) add store={'class.y': (lambda self, cr, uid, ids, c={}: ids, ['x_id'], 10)} for 'field_count'
=>same problem of update for 'field_count'