Do not read rec_name of unsaved records

issue9308
review327381002
This commit is contained in:
Sergi Almacellas Abellana committed 2020-07-06 17:40:28 +02:00
1 parent 19ca791323
commit 41efe00ace
1 file changed
+7 -2
+7 -2
View File
@@ -29,7 +29,12 @@
return jQuery.when(name);
}
var max_records = 5;
var ids = data.ids.slice(0, max_records);
var ids = data.ids.filter(function(id){
return id >= 0;
}).slice(0, max_records);
if (!ids.length) {
return jQuery.when(name);
}
return Sao.rpc({
'method': 'model.' + data.model + '.read',
'params': [ids, ['rec_name'], context]
@@ -38,7 +43,7 @@
return record.rec_name;
}).join(Sao.i18n.gettext(', '));
if (data.ids.length > max_records) {
if (data.ids.length > ids.length) {
name_suffix += Sao.i18n.gettext(',...');
}
return Sao.i18n.gettext('%1 (%2)', name, name_suffix);