Skip to Content
Menu
This question has been flagged
1060 Views

What is the clever way to get fields of related records using the extract API? I was under the impression I can use the dot separator to get the fields. Probably I brought that from working with ServiceNow. I ran into errors when I tried to do that. I read the docs and I do not know what to do now. I can always make multiple subsequent queries to get the fields of the related records based on the IDs but I'd like to avoid that. Thinking about adding a computed field that returns the value of the field of the related model, but I think that would create extra database calls in Odoo. A bit better, but still seems a waste of resources. Do I need to create a custom function where I query the database with join? What would you do?

To be more concrete, I want to get certain fields od res_partner when I query mail.message. Tried author_id.fields, but that throws error saying that author_id.field is not a field of mail.message.

Avatar
Discard