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.
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([
],'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.
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
|Asked: 4/8/16, 5:44 AM|
|Seen: 522 times|
|Last updated: 4/9/16, 5:27 AM|