Odoo Help


domain many2one

Badache Zoubir
on 9/27/16, 11:55 AM 727 views

how to change the domain many2one when changing field Selection?

use domain on the many2one field in xml file that code something like

domain="[('key', '=', selection_fields)]" but you need to some relation between selection field and many2one fields.

i give one example:

<field string="Vendor" name="partner_id" domain="[('supplier', '=', True)]"/>

Jitendra Prajapati (jpr)
on 9/28/16, 3:15 AM

Bejaoui Souheil

--Bejaoui Souheil--
--Bejaoui Souheil--

Odoo developer,  functional and technical consultant


Bejaoui Souheil
On 9/28/16, 3:55 AM


If you have to set a domain on field if a value of an other field is changed, set an onchange method like this:

def do_stuff(self):
    return {'domain':[Your domain]}

    # Here you can call field selection by using self.selection

Best regards

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.


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

2 follower(s)


Asked: 9/27/16, 11:55 AM
Seen: 727 times
Last updated: 11/19/16, 4:21 AM