changeset 7cc135d9ee8d in sao:5.2
details: https://hg.tryton.org/sao?cmd=changeset;node=7cc135d9ee8d
description:
        Compare record against the current record of the screen

        Also store the view instead of the screen like in tryton.

        issue8386
        review263551002
        (grafted from 2bde5d20a57863fadc1d78599b96dac5285e57af)
diffstat:

 src/view/tree.js |  12 ++++++------
 1 files changed, 6 insertions(+), 6 deletions(-)

diffs (50 lines):

diff -r 041a50d4da98 -r 7cc135d9ee8d src/view/tree.js
--- a/src/view/tree.js  Tue May 28 09:53:36 2019 +0200
+++ b/src/view/tree.js  Wed Jun 12 19:02:56 2019 +0200
@@ -68,7 +68,7 @@
         },
         _parse_button: function(node, attributes) {
             var column = new Sao.View.Tree.ButtonColumn(
-                this.view.screen, attributes);
+                this.view, attributes);
             this.view.columns.push(column);
         }
     });
@@ -1955,8 +1955,8 @@
     });
 
     Sao.View.Tree.ButtonColumn = Sao.class_(Object, {
-        init: function(screen, attributes) {
-            this.screen = screen;
+        init: function(view, attributes) {
+            this.view = view;
             this.type = 'button';
             this.attributes = attributes;
         },
@@ -1966,7 +1966,7 @@
                 button.el.click(
                         [record, button], this.button_clicked.bind(this));
             }
-            var fields = jQuery.map(this.screen.model.fields,
+            var fields = jQuery.map(this.view.screen.model.fields,
                 function(field, name) {
                     if ((field.description.loading || 'eager') ==
                         'eager') {
@@ -1984,7 +1984,7 @@
         button_clicked: function(event) {
             var record = event.data[0];
             var button = event.data[1];
-            if (record != this.record) {
+            if (record != this.view.screen.current_record) {
                 // Need to raise the event to get the record selected
                 return true;
             }
@@ -1993,7 +1993,7 @@
                 return;
             }
             button.el.prop('disabled', true);
-            this.screen.button(this.attributes).always(function() {
+            this.view.screen.button(this.attributes).always(function() {
                 button.el.prop('disabled', false);
             });
         }

Reply via email to