Odoo Help


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.


wrong domain values many2one field

on 12/10/14, 5:59 AM 374 views


i want to change the domain of many2one field to present new records , the code worked fine but with wrong values

after i invoke the function : the values first will present the comanies name and if i click on one company , the values which i want (customer names ) will appeare .

how i can remove the first list which is the locations ? and from where this values retrieved i don't know .


My Code :




<field name="customer_name" widget="selection"/>

#---------- Function


        myobj = self.pool.get('res.partner')
        ids = myobj.search(cr, uid, [])
        for id in ids:
            customer = self.pool.get('res.partner').browse(cr, uid, [id], {})            
            if customer.country_id.id == customer_country:
        return {'domain':{'customer_name':[('name','=',cus_array)]}}



| 5 3 6
Jakarta, Indonesia
On 12/10/14, 6:21 AM

I would advise you to read the answer to this question: https://www.odoo.com/forum/help-1/question/best-practices-as-to-when-to-use-fields-selection-vs-fields-many2one-69262.

You cannot dynamically domain a many2one field with widget="selection".

On 12/10/14, 7:10 AM

well done thats worked for me ^____________^


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)


Asked: 12/10/14, 5:59 AM
Seen: 374 times
Last updated: 3/16/15, 8:10 AM