Allow to read related xxx2Many

(Cédric Krier) #1


For now, the can be used to read direct field and related field from xxx2One or Reference. This API has been developed mainly for the client needs. But sometimes when integrating with other system, it will be more performant if we could read also other related fields.


Allow to pass to xxx2Many related fields.
Here is an example of such call and the result:

read([id,…], {'name', '', 'addresses', '','',  'addresses.subdivision'})
-> [{'id': 1, 'name': 'foo', '': 'French', 'addresses': [3, …], 'addresses.': [{'id': 3, 'country': 2, 'country.code': 'FR', 'subdivision': 5}, {…}, …]}, …]

So as soon as there are xxx2Many related fields, the result value for the field is a list of dictionary with the requested value plus always the id.
:warning: the name of the key is suffixed by a . to not collide with legacy result.
The API for xxx2One is not changed.
Of course the access rights must still be enforced.


Newsletter January 2019
(Cédric Krier) #2

I think we should replace the syntax for xxx2One and Reference also by ending dot followed by a dictionary of value. This will bring more consistency and I think it worth the backward compatibility break.

(Sergi Almacellas Abellana) #3

Will the clients be updated to follow this new API?
I’m wonering if it will be a good improvement for rendering forms with some XXX2Many fields, for example the form.

(Cédric Krier) #4

It is needed to keep the rec_name tuning.

I do not see how we could make improvement without losing the lazy loading. We need to know how much records a xxx2Many has before deciding how much should be loaded.

(Cédric Krier) #5

(Cédric Krier) #6

(Cédric Krier) #7

This topic was automatically closed after 13 days. New replies are no longer allowed.