changeset 610:d277cff577d0

Fix Field.get_data when data is already read When data is already in _values, it should return a promise with it.
author Cédric Krier <ced@b2ck.com>
date Sun, 27 Dec 2015 19:24:39 +0100
parents bc365f174a3a
children 8b1a6d7a92fb
files src/model.js
diffstat 1 files changed, 4 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/src/model.js	Sun Dec 27 19:23:22 2015 +0100
+++ b/src/model.js	Sun Dec 27 19:24:39 2015 +0100
@@ -2243,7 +2243,7 @@
             return data;
         },
         get_data: function(record) {
-            var prm = jQuery.when();
+            var prm;
             var data = record._values[this.name] || 0;
             if (!(data instanceof Uint8Array)) {
                 if (record.id < 0) {
@@ -2255,8 +2255,10 @@
                 prm.done(function(data) {
                     return data[0][this.name];
                 }.bind(this));
-                return prm;
+            } else {
+                prm = jQuery.when(data);
             }
+            return prm;
         }
     });
 

Repository Layout

/ Tryton top level repositories
modules Modules
public Public repositories
tpf Tryton Foundation repositories
sandbox Sandbox