Live Chat
True
FAQs
Development

How does Odoo store One2Many fields?

I need to access One2Many field via SQL query, but i can't find it in the  Model's table. my model is called `subscription.subscription` and it has this field:

'function_line_ids': fields.one2many('subscription.function.subscription.line', 'subscription_id', 'Functions'),


i need this field, but as i said cant find it on the model's table. Where does odoo store this information


You can assume that in database "ID's are saved at «many» side" i.e. if you've two objects(models) 'object_a' and 'object_b' and you've relational field in the 'object_a' :


if field type is one2many, then ID's(of object_a) are saved in 'object_b' (object_b is at «many» side, it contains ids)


if field type is 'many2one', then ID's(of object_b) are saved in 'object_a' (object_a is at «many» side, it contains ids)


if field type is many2many, then ID's(of both objects) are saved in the separated table (it's exception as ids are not either in A or in B, but they are in the table that may be named using "relation" parameter of many2many fiel



Was this article helpful?

FAQ HOME

To install this Web App in your iPhone/iPad press and then Add to Home Screen.