Eagerly read string value of multiselection fields
The changeset 2763339d88d5 implemented the rendering of multiselection from :string but the record does not read them.
This commit is contained in:
@@ -1,3 +1,4 @@
|
||||
* Eagerly read string value of multiselection fields
|
||||
* Use locale timezone for CSV in locale format
|
||||
|
||||
Version 6.8.0 - 2023-05-01
|
||||
|
||||
+6
-4
@@ -669,12 +669,13 @@
|
||||
}
|
||||
var fnames_to_fetch = fnames.slice();
|
||||
var rec_named_fields = ['many2one', 'one2one', 'reference'];
|
||||
const selection_fields = ['selection', 'multiselection'];
|
||||
for (const fname of fnames) {
|
||||
var fdescription = this.model.fields[fname].description;
|
||||
if (~rec_named_fields.indexOf(fdescription.type))
|
||||
fnames_to_fetch.push(fname + '.rec_name');
|
||||
else if ((fdescription.type == 'selection') &&
|
||||
((fdescription.loading || 'lazy') == 'eager')) {
|
||||
else if (~selection_fields.indexOf(fdescription.type) &&
|
||||
((fdescription.loading || 'lazy') == 'eager')) {
|
||||
fnames_to_fetch.push(fname + ':string');
|
||||
}
|
||||
}
|
||||
@@ -842,8 +843,9 @@
|
||||
(field instanceof Sao.field.Reference)) {
|
||||
related = name + '.';
|
||||
this._values[related] = values[related] || {};
|
||||
} else if ((field instanceof Sao.field.Selection) &&
|
||||
(name + ':string' in values)){
|
||||
} else if (((field instanceof Sao.field.Selection) ||
|
||||
(field instanceof Sao.field.MultiSelection)) &&
|
||||
(name + ':string' in values)) {
|
||||
related = name + ':string';
|
||||
this._values[related] = values[related];
|
||||
}
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
* Eagerly read string value of multiselection fields
|
||||
* Use locale timezone for CSV in locale format
|
||||
* Display sum on column header
|
||||
|
||||
|
||||
@@ -83,7 +83,7 @@ class Record:
|
||||
f_attrs = self.group.fields[fname].attrs
|
||||
if f_attrs['type'] in {'many2one', 'one2one', 'reference'}:
|
||||
fnames.append('%s.rec_name' % fname)
|
||||
elif (f_attrs['type'] == 'selection'
|
||||
elif (f_attrs['type'] in {'selection', 'multiselection'}
|
||||
and f_attrs.get('loading', 'lazy') == 'eager'):
|
||||
fnames.append('%s:string' % fname)
|
||||
if 'rec_name' not in fnames:
|
||||
@@ -480,7 +480,8 @@ class Record:
|
||||
if isinstance(field, (fields.M2OField, fields.ReferenceField)):
|
||||
related = fieldname + '.'
|
||||
self.value[related] = val.get(related) or {}
|
||||
elif (isinstance(field, fields.SelectionField)
|
||||
elif (isinstance(field, (
|
||||
fields.SelectionField, fields.MultiSelectionField))
|
||||
and fieldname + ':string' in val):
|
||||
related = fieldname + ':string'
|
||||
self.value[related] = val[related]
|
||||
|
||||
Reference in New Issue
Block a user