Skip to Content
Menu
This question has been flagged
4095 Views

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'

Avatar
Discard
Related Posts Replies Views Activity
2
Jan 23
23781
4
Jun 21
37399
1
Dec 20
1488
1
Apr 18
6459
3
Sep 15
8481