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.

3

How to do an advanced search of an one2many field?

By
Juan Formoso
on 1/12/15, 6:24 AM 853 views

I created a new field in res.partner model, named rplc. This field is a one2many pointing to other model named res.partner.link.category.

I've checked that if I select rplc in the advanced search, it's filtering by the name or _rec_name of the records of res.partner.link.category. For example, if I go to the advanced search of partners, select rplc and write "Friend" as the content, it looks for every record of res.partner.link.category whose name's "Friend".

Now, my question: res.partner.link.category has other columns (in addition to name), one of them is type.

How can I do if I want to create a filter in the advanced search of res.partner selecting not only name but also type of res.partner.link.category? For example, I want to see every partner whose rplc has any record with name "Friend" and type "Good".

Is this possible? Thank you in advance!

is this question for v7 or v8?

Atchuthan - Technical Consultant, Sodexis Inc
on 1/12/15, 6:40 AM

Sorry, I forgot to specify it, it's a v7.

Juan Formoso
on 1/12/15, 6:48 AM

Could you solve this issue?

MEXYTUL, Diego Calzadilla
on 5/24/15, 5:54 PM

@Diego Calzadilla Now I'm looking why I didn't post my answer earlier and that's because I didn't manage to solve that issue exactly, I have to do a workaround, and I think the final solution is not the answer to this question. In my case, I only wanted to show the *rplc* records which the searched name and always type "*Good*". That was an advantage to do it next way: I had created a one2many of type function, and used the property *fnct_search*. From this property you can call a function made by yourself (you are going to receive the args the user wrote in the search, including the operator). In this function, you can do what you want, but you must return a *domain* (for example: [('id', in, your_list_of_ids)])

Juan Formoso
on 5/25/15, 4:01 AM

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: 1/12/15, 6:24 AM
Seen: 853 times
Last updated: 5/25/15, 4:01 AM