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.

1

[New api]Return a domain in on change

By
Jesús Ventosinos
on 8/13/14, 5:42 AM 2,777 views

With the old api we could return a domain in the on change function, is this possible with the new api?

2
Jesús Ventosinos
On 8/18/14, 12:16 PM

ok, its possible, but if the function has the decorator @api.one not works.

my error:

    @api.one
    @api.onchange('field_id')
     def onchange_field_id(self):
         relation_ids = [x.id for x in self.field_id.relation_ids]
         return {'domain':{'relation_id': [('id', 'in', relation_ids)]}}

but without @api.one works perfectly

    @api.onchange('field_id')
     def onchange_field_id(self):
         relation_ids = [x.id for x in self.field_id.relation_ids]
         return {'domain':{'relation_id': [('id', 'in', relation_ids)]}}

0
Deviprasad V
On 8/17/14, 6:55 AM

Yes, Its possible an onchange method can return three items (warning, domain, value)

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: 8/13/14, 5:42 AM
Seen: 2777 times
Last updated: 3/16/15, 8:10 AM