Odoo Help

2

[New api]Return a domain in on change

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

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

4
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)]}}

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

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

0
Sehrish
On 3/9/18, 5:00 AM

You can also use @api.multi

About This Community

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

Register

Odoo Training Center

Access to our E-learning platform and experience all Odoo Apps through learning videos, exercises and Quizz.

Test it now

Question tools

1 follower(s)

Stats

Asked: 8/13/14, 5:42 AM
Seen: 4911 times
Last updated: 3/9/18, 5:00 AM