Odoo Help


4 Answers

Nicolas Bessi İsviçre

--Nicolas Bessi--

| 5 7 10
Lausanne, İsviçre
--Nicolas Bessi--
Nicolas Bessi İsviçre
7.02.2013 08:48

As far as I know this feature is not supported. You have to implement fnct_search of you function field, but I never try to do it on a one2many field and can not guarantee it works.

Thibaut DIRLIK Fransa
7.02.2013 09:39

As said by @nbessi, you have to define fnct_search which will let you do what you want. By definition, you can't store a one2many, it doesn't make any sense.

Yug Faa Fas
8.02.2013 07:16

I had edit this syntax to :

'user_ids': fields.function(
        _get_marche_users, string='Chefs',
        type='one2many', readonly=True,
        relation='res.users', multi='marche_users',

the function _get_marche_users get users ids by intelligence and it works.

I know that the function _users_search must return this syntax :


and res is a list

I formulate now the question : res is it the table of ids of users that returned by the function _get_marche_users ? Really I need a full example, I grep the code and I have a big problem in a interresting project I don't found the documentation, just the prototype that's not sufficient, and I can't understand the source code so a help please I will be so grateful for you

1 Comment
Camptocamp SA İsviçre
28.02.2013 16:08

A function search needs to return the ids of for the object, not for the relation object.

In your case, you must return ids of the object having Chefs lets say it is a Restaurant

So you have to search first for res.user ids matching a name. Then check if those ids are included in your Restaurant.

And for Restaurant that match this condition, you add it's id in your res list

Nhomar Hernandez Meksika
7.02.2013 08:57


Please try this:

The function related, must always return an iterable, if in some case it can return None it will explode,

If you try a Python console:

>>> None[1]
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
TypeError: 'NoneType' object has no attribute '__getitem__'

See, i'm obtaining almost the same error becasue the ORM is not capable to manage a value of a type different to what it is specting, can you try and tell me the result.


BTW: It should be cool if you can share branch wih your module to see all the py file, regards.

Ask a Question
Keep Informed
1 follower(s)
About This Community

This platform 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.

Odoo Training Center

Access to our E-learning platform and experience all Odoo Apps through learning videos, exercises and Quizz.

Test it now