Odoo Help

0

domain many2one

By
Badache Zoubir
on 9/27/16, 11:55 AM 504 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
1

Bejaoui Souheil

--Bejaoui Souheil--
1051
| 2 1 5
Rennes, France
--Bejaoui Souheil--

Odoo developer,  functional and technical consultant

souheil_bejaoui@hotmail.fr

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

Hi,

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

@api.onchange('selection')
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.

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

2 follower(s)

Stats

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