Load sub-fields of xxx2Many only for lazy loading

The sub-fields are not needed for eager loading view like the tree because they
are rendered with only the number of records.

Closes #14305
This commit is contained in:
Cédric Krier committed 2025-10-21 12:14:04 +02:00
1 parent 6ebc55a14e
commit ff2c9f7bc3
2 files changed
+4 -2

No files matched your search

+2 -1
View File
@@ -721,7 +721,8 @@
((fdescription.loading || 'lazy') == 'eager')) {
fnames_to_fetch.push(fname + ':string');
} else if (
['many2many', 'one2many'].includes(fdescription.type)) {
['many2many', 'one2many'].includes(fdescription.type) &&
(loading == 'lazy')) {
var sub_fields = get_x2m_sub_fields(fdescription, fname);
fnames_to_fetch = [ ...fnames_to_fetch, ...sub_fields];
if (sub_fields.length > 0) {
@@ -115,7 +115,8 @@ class Record:
elif (f_attrs['type'] in {'selection', 'multiselection'}
and f_attrs.get('loading', 'lazy') == 'eager'):
fnames.append('%s:string' % fname)
elif f_attrs['type'] in {'many2many', 'one2many'}:
elif (f_attrs['type'] in {'many2many', 'one2many'}
and loading == 'lazy'):
sub_fields = get_x2m_sub_fields(f_attrs, fname)
fnames.extend(sub_fields)
if sub_fields: