summaryrefslogtreecommitdiff
path: root/addons/web/static/src/js/data.js
diff options
context:
space:
mode:
authorChristophe Simonis <chs@openerp.com>2012-11-08 17:34:58 +0100
committerChristophe Simonis <chs@openerp.com>2012-11-08 17:34:58 +0100
commit6436f75513efd9c4597cb95babfa5dce840237fc (patch)
tree19b055be0b820314d18bf616199c6bc197e50e6e /addons/web/static/src/js/data.js
parenteaa3da915b5c3b22ddaaa2f4e29b1854e748e2f1 (diff)
parentbbb51923461bf1237cb4f1635381e85008f4fc0e (diff)
merge upstream
bzr revid: chs@openerp.com-20121108163458-wk7p4mf7fyh3winl
Diffstat (limited to 'addons/web/static/src/js/data.js')
-rw-r--r--addons/web/static/src/js/data.js32
1 files changed, 16 insertions, 16 deletions
diff --git a/addons/web/static/src/js/data.js b/addons/web/static/src/js/data.js
index 63c90f53758..2f8679794b0 100644
--- a/addons/web/static/src/js/data.js
+++ b/addons/web/static/src/js/data.js
@@ -66,7 +66,7 @@ instance.web.Query = instance.web.Class.extend({
offset: this._offset,
limit: this._limit,
sort: instance.web.serialize_sort(this._order_by)
- }).pipe(function (results) {
+ }).then(function (results) {
self._count = results.length;
return results.records;
}, null);
@@ -78,7 +78,7 @@ instance.web.Query = instance.web.Class.extend({
*/
first: function () {
var self = this;
- return this.clone({limit: 1})._execute().pipe(function (records) {
+ return this.clone({limit: 1})._execute().then(function (records) {
delete self._count;
if (records.length) { return records[0]; }
return null;
@@ -132,7 +132,7 @@ instance.web.Query = instance.web.Class.extend({
offset: this._offset,
limit: this._limit,
orderby: instance.web.serialize_sort(this._order_by) || false
- }).pipe(function (results) {
+ }).then(function (results) {
return _(results).map(function (result) {
// FIX: querygroup initialization
result.__context = result.__context || {};
@@ -443,7 +443,7 @@ instance.web.DataSet = instance.web.CallbackEnabled.extend({
return this._model.query(fields)
.limit(options.limit || false)
.offset(options.offset || 0)
- .all().then(function (records) {
+ .all().done(function (records) {
self.ids = _(records).pluck('id');
});
},
@@ -456,7 +456,7 @@ instance.web.DataSet = instance.web.CallbackEnabled.extend({
*/
read_index: function (fields, options) {
options = options || {};
- return this.read_ids([this.ids[this.index]], fields, options).pipe(function (records) {
+ return this.read_ids([this.ids[this.index]], fields, options).then(function (records) {
if (_.isEmpty(records)) { return $.Deferred().reject().promise(); }
return records[0];
});
@@ -493,7 +493,7 @@ instance.web.DataSet = instance.web.CallbackEnabled.extend({
*/
write: function (id, data, options) {
options = options || {};
- return this._model.call('write', [[id], data], {context: this.get_context(options.context)}).then(this.trigger('dataset_changed', id, data, options));
+ return this._model.call('write', [[id], data], {context: this.get_context(options.context)}).done(this.trigger('dataset_changed', id, data, options));
},
/**
* Deletes an existing record from the database
@@ -501,7 +501,7 @@ instance.web.DataSet = instance.web.CallbackEnabled.extend({
* @param {Number|String} ids identifier of the record to delete
*/
unlink: function(ids) {
- return this._model.call('unlink', [ids], {context: this.get_context()}).then(this.trigger('dataset_changed', ids));
+ return this._model.call('unlink', [ids], {context: this.get_context()}).done(this.trigger('dataset_changed', ids));
},
/**
* Calls an arbitrary RPC method
@@ -607,7 +607,7 @@ instance.web.DataSet = instance.web.CallbackEnabled.extend({
model: this.model,
ids: ids,
context: this.get_context(options.context),
- }).pipe(function (results) {
+ }).then(function (results) {
return results;
});
},
@@ -682,9 +682,9 @@ instance.web.DataSetSearch = instance.web.DataSet.extend({
.limit(options.limit || false);
q = q.order_by.apply(q, this._sort);
- return q.all().then(function (records) {
+ return q.all().done(function (records) {
// FIXME: not sure about that one, *could* have discarded count
- q.count().then(function (count) { self._length = count; });
+ q.count().done(function (count) { self._length = count; });
self.ids = _(records).pluck('id');
});
},
@@ -693,7 +693,7 @@ instance.web.DataSetSearch = instance.web.DataSet.extend({
},
unlink: function(ids, callback, error_callback) {
var self = this;
- return this._super(ids).then(function(result) {
+ return this._super(ids).done(function(result) {
self.ids = _(self.ids).difference(ids);
if (self._length) {
self._length -= 1;
@@ -722,7 +722,7 @@ instance.web.BufferedDataSet = instance.web.DataSetStatic.extend({
this.last_default_get = {};
},
default_get: function(fields, options) {
- return this._super(fields, options).then(this.on_default_get);
+ return this._super(fields, options).done(this.on_default_get);
},
on_default_get: function(res) {
this.last_default_get = res;
@@ -774,7 +774,7 @@ instance.web.BufferedDataSet = instance.web.DataSetStatic.extend({
this.cache = _.reject(this.cache, function(x) { return _.include(ids, x.id);});
this.set_ids(_.without.apply(_, [this.ids].concat(ids)));
this.trigger("dataset_changed", ids, callback, error_callback);
- return $.async_when({result: true}).then(callback);
+ return $.async_when({result: true}).done(callback);
},
reset_ids: function(ids) {
this.set_ids(ids);
@@ -836,7 +836,7 @@ instance.web.BufferedDataSet = instance.web.DataSetStatic.extend({
completion.resolve(records);
};
if(to_get.length > 0) {
- var rpc_promise = this._super(to_get, fields, options).then(function(records) {
+ var rpc_promise = this._super(to_get, fields, options).done(function(records) {
_.each(records, function(record, index) {
var id = to_get[index];
var cached = _.detect(self.cache, function(x) {return x.id === id;});
@@ -991,14 +991,14 @@ instance.web.DropMisordered = instance.web.Class.extend({
var res = $.Deferred();
var self = this, seq = this.lsn++;
- deferred.then(function () {
+ deferred.done(function () {
if (seq > self.rsn) {
self.rsn = seq;
res.resolve.apply(res, arguments);
} else if (self.failMisordered) {
res.reject();
}
- }, function () {
+ }).fail(function () {
res.reject.apply(res, arguments);
});