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

domain many2one

By
Badache Zoubir
on 9/27/16, 11:55 AM 224 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--
808
| 2 1 4
Sousse, Tunisia
--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

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

2 follower(s)

Stats

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