Odoo Help

Welcome!

This community 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.

0

Update function field with store=True

By
mehdi
on 5/18/15, 10:33 AM 711 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'

Your Answer

Please try to give a substantial answer. If you wanted to comment on the question or answer, just use the commenting tool. Please remember that you can always revise your answers - no need to answer the same question twice. Also, please don't forget to vote - it really helps to select the best questions and answers!

About This Community

This community is for professionals and enthusiasts of our products and services. Read Guidelines

Question tools

1 follower(s)

Stats

Asked: 5/18/15, 10:33 AM
Seen: 711 times
Last updated: 5/18/15, 10:33 AM