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.

1

Domain one2many field?

By
Prakash
on 2/19/13, 8:55 AM 3,890 views

Using Domain how to filter one2many Fields (job_ids) is equal to [] or job_ids.contact_id is null.

domain="[('job_ids','=',[])]"

domain="[('job_ids.contact_id','=',False)]"

Tried the above 2 code is not working

Thanks

What do you exactly want to do?

Andreas Brueckl
on 2/19/13, 9:16 AM

The second one cannot work, you are demanding the contact_id of a list of job_ids

Camptocamp SA
on 2/19/13, 1:29 PM
0

Prakash

--Prakash--
3173
| 5 4 7
Bikaner, India
--Prakash--

OpenERP Devloper at SunARC Technology

Prakash
On 2/20/13, 1:12 AM

Actual requirement contact name shows only not related partner.

The below domain is not working job_ids is one2many field in res.partner.contact

'contact_id' : fields.many2one('res.partner.contact', 'Contact', domain="[('job_ids','=',[])]"),

Solved domain="[('job_ids','=',False)]")

Prakash
on 2/20/13, 4:14 AM

Okay, I misunderstood your question. I have deleted my answer.

Camptocamp SA
on 2/20/13, 6:03 AM
0

Yannick Vaucher

--Yannick Vaucher--
1699
| 5 7 9
Lausanne, Switzerland
--Yannick Vaucher--
Yannick Vaucher
On 2/19/13, 2:02 PM

To filter in many2one, one2many and many2many, you have to directly use the fields of the related object.

For exemple:

'job_ids': fields.on2many(
         ...
         domain="[('contact_id','=',False)]")

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

0 follower(s)

Stats

Asked: 2/19/13, 8:55 AM
Seen: 3890 times
Last updated: 3/16/15, 8:10 AM