changeset b5b3fe01ebaf in sao:5.6
details: https://hg.tryton.org/sao?cmd=changeset;node=b5b3fe01ebaf
description:
        Do not read rec_name of unsaved records

        issue9308
        review327381002
        (grafted from f083aa46ac949315b2d2777e6e46566b499a1193)
diffstat:

 src/action.js |  9 +++++++--
 1 files changed, 7 insertions(+), 2 deletions(-)

diffs (26 lines):

diff -r e2ffcad43695 -r b5b3fe01ebaf src/action.js
--- a/src/action.js     Sat Jul 04 19:56:25 2020 +0200
+++ b/src/action.js     Mon Jul 06 17:40:28 2020 +0200
@@ -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(',\u2026');
                 }
                 return Sao.i18n.gettext('%1 (%2)', name, name_suffix);

Reply via email to