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.


add implied_ids in group

on 11/28/13, 12:16 PM 2,372 views

Hello everyone, I have a problem when I try to add a implied_id in the implied_ids atribute of res.groups. I tried this code:

implied_id = obj.search([('name', '=', 'Mostrar las iniciativas propias')]) (if I print this variable I get this result: [7]

group_id = oerp.create('res.groups', {'name': name_group, 'category_id': category_id[0], 'implied_ids': implied_id})

The group is created correctly with his name and category, but implied_ids is empty... I don't know why...

I use the oerplib.

Somebody knows what I'm doing wrong?

Thank you in advance

Sebastien Alix
On 11/29/13, 10:54 AM


To link an existing resource in a one2many or many2many fields (as suggests your 'implied_ids' field), you need to use the "magic" numbers of OpenERP to tell what you want to do:

group_id = oerp.create('res.groups', {'name': name_group, 'category_id': category_id[0], 'implied_ids': [(4, implied_id)]})

In a one2many or many2many field, you have to use a list of tuples, e.g => [(4, ID)] '4' means 'link', '2' to remove a resource, '3' to remove and unlink... etc. See the 'openerp/osv/fields.py' file, there is some documentation. Maybe I should add this in the documentation of OERPLib directly.


EDIT: If 'implied_id' is a list with one element, you could use either [(6, implie_id)] or [(4, implied_id[0])].

On 11/29/13, 11:17 AM

Thank you very much Sébastien Alix It helped me a lot!

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: 11/28/13, 12:16 PM
Seen: 2372 times
Last updated: 3/16/15, 8:10 AM