Odoo Help


One2Many and Many2Many properties

Yurdik Cervantes Mendoza
on 4/8/16, 5:44 AM 1,266 views

In recent versions of odoo we have the company_dependent attribute instead of the property definitions....

It seems not to work in One2Many and Many2Many fields.

I see no use of the company_dependent attribute in those kind of fields when I search into the code:


My question is:

Is that supposed to work ? Or should the code raise an Exception in those cases?

Which alternatives do we have ? Implement that by hand with domains ?

Maybe the ORM could check if the related entity has a company_id field and add the restriction to the domain automatically, also it could add the company_id field to the related model or comodel.


Axel Mendoza

--Axel Mendoza--
| 7 8 8
Camaguey, Cuba
--Axel Mendoza--

DevOps - Full stack - Software Architect - Developer - Technology Integrator

I could help you to develop anything and solve complex problems based on technologies, integrations and tricky stuffs mostly in Python with OpenERP/Odoo, Zato, Django and many others frameworks programming languages and technologies.

I offers consulting services to anyone with an unanswered questions or needs for customizations. Think about it, maybe it's better to have an expert to solve your issues and projects than having a full-time employee trying to understand what to do and how

Reach me at aekroft@gmail.com

Axel Mendoza
On 4/8/16, 7:51 PM

Hi Yurdik

The fields marked as company_dependent are transformed internally into old fields.property that relays on ir.property model to store the values and that one only support this types of fields:

'type' : fields.selection([

('char', 'Char'),

('float', 'Float'),

('boolean', 'Boolean'),

('integer', 'Integer'),

('text', 'Text'),

('binary', 'Binary'),

('many2one', 'Many2One'),

('date', 'Date'),

('datetime', 'DateTime'),

('selection', 'Selection'),

],'Type', required=True, select=1),

As you see there is no support for One2many or Many2many fields. To do it you could use the combination of the a company_id field on the comodel and an ir.rule record that will restrict the values that you could use in the relation fields depending on the users companies. The record rules will restrict the records for all the users except for admin.

Thank you for this confirmation. Anyway I think that should be managed automatically by the ORM or raise an exception "company_dependent attribute not supported for One2Many and Many2Many fields"

Yurdik Cervantes Mendoza
on 4/9/16, 5:10 AM

I did submit a new issue: https://github.com/odoo/odoo/issues/11647

Yurdik Cervantes Mendoza
on 4/9/16, 5:25 AM

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

Question tools

1 follower(s)


Asked: 4/8/16, 5:44 AM
Seen: 1266 times
Last updated: 4/9/16, 5:27 AM