changeset 416fc7392e87 in sao:5.8
details: https://hg.tryton.org/sao?cmd=changeset&node=416fc7392e87
description:
        Fall-back to default order to define new position

        When there is no order on the screen, we must use the default order 
because it
        contains the order of the relation field.

        issue10298
        review340621002
        (grafted from 8649ac63e0f2c7a6569cb5c31cb60e558527f50a)
diffstat:

 src/screen.js |  14 ++++++++++----
 1 files changed, 10 insertions(+), 4 deletions(-)

diffs (24 lines):

diff -r 805866f2cd51 -r 416fc7392e87 src/screen.js
--- a/src/screen.js     Wed Apr 21 23:47:30 2021 +0200
+++ b/src/screen.js     Wed Apr 21 23:51:15 2021 +0200
@@ -1436,10 +1436,16 @@
             }.bind(this));
         },
         get new_position() {
-            if (this.order) {
-                for (var j = 0; j < this.order.length; j++) {
-                    var oexpr = this.order[j][0],
-                        otype = this.order[j][1];
+            var order;
+            if (this.order !== null) {
+                order = this.order;
+            } else {
+                order = this.default_order;
+            }
+            if (order) {
+                for (var j = 0; j < order.length; j++) {
+                    var oexpr = order[j][0],
+                        otype = order[j][1];
                     if ((oexpr == 'id') && otype) {
                         if (otype.startsWith('DESC')) {
                             return 0;

Reply via email to