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.


How to use fnct_search?

Juan Formoso
on 1/13/15, 6:43 AM 864 views

I created a new model named rpe.link.category, with some columns such as name, type, date... There is a many2many relationship between this new model and res.partner.

On the other hand, I added a new field in the res.partner model, named categories_tags. This is a function field, which returns a specific group of rpe.link.category IDs for each res.partner ID.

For example:

{1: [7, 8, 9], 2: [7, 8], 3: [8, 9] }, where 1, 2 and 3 are res.partner IDs and 7, 8 and 9 are rpe.link.category IDs.

So my function field is this one:

'categories_tags': fields.function(_get_link_category_tags,
     type='many2many', obj='rpe.link.category',
     method=True, string='Categories', fnct_search=_search_group),

What I want now is:

When I open the res.partner tree view, I can do an advanced searching. As my field is not being stored in the database, it didn't appear, but I realized that if I specified the argument fnct_search, it did.

Now I would like to know how can I do to specify in the advanced searching the name of a rpe.link.category and get every res.partner who is related to it in my function field. Keeping on with the previous example: let's imagine that the ID 7 of rpe.link.category has "Friend" as name. If I go to the advanced searching and write Categories / ilike / Friend, I should see the res.partner objects with ID 1 and 2, but not 3.

I'm not sure of how to manage this with fnct_search, or if is this the best way to achieve my purpose. Can anybody help me here, please?


michel Guénard

--michel Guénard--
| 5 5 8
--michel Guénard--

VP operations & finance Social entrepreneur Certified Public Accountant Past Chief internal auditor

michel Guénard
On 1/15/15, 4:12 AM

I understand that you need an implementation of the so called "foaf" model (FOAF means Friend of a Friend) which is the model that makes the foundation of Facebook for instance.

Including the Foaf into the Odoo framework would certainly enhance the capacities to work with any third-parties a company is involved with.

For instance, a web visitor (after registration) would be allowed to like/unlike a product or a blog page or a comment, thus allowing any kind of follow-up strategy

As far as I understand the actual Odoo, it has some sort of a FOAF model represented by the "is_follower"; however this is limited to the internal functionning of the company.

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: 1/13/15, 6:43 AM
Seen: 864 times
Last updated: 3/16/15, 8:10 AM