[IMP] callback2deferred part1 dataset.unlink
bzr revid: al@openerp.com-20120927234513-3aohele9gcoxkha4
This commit is contained in:
parent
2f1948389e
commit
a55cc6072a
|
@ -664,10 +664,8 @@ instance.web.DataSet = instance.web.CallbackEnabled.extend({
|
||||||
* @param {Function} callback function called with operation result
|
* @param {Function} callback function called with operation result
|
||||||
* @param {Function} error_callback function called in case of deletion error
|
* @param {Function} error_callback function called in case of deletion error
|
||||||
*/
|
*/
|
||||||
unlink: function(ids, callback, error_callback) {
|
unlink: function(ids) {
|
||||||
return this._model.call('unlink',
|
return this._model.call('unlink', [ids], {context: this._model.context()});
|
||||||
[ids], {context: this._model.context()})
|
|
||||||
.then(callback, error_callback);
|
|
||||||
},
|
},
|
||||||
/**
|
/**
|
||||||
* Calls an arbitrary RPC method
|
* Calls an arbitrary RPC method
|
||||||
|
@ -889,7 +887,7 @@ instance.web.DataSetSearch = instance.web.DataSet.extend({
|
||||||
},
|
},
|
||||||
unlink: function(ids, callback, error_callback) {
|
unlink: function(ids, callback, error_callback) {
|
||||||
var self = this;
|
var self = this;
|
||||||
return this._super(ids, function(result) {
|
return this._super(ids).then(function(result) {
|
||||||
self.ids = _(self.ids).difference(ids);
|
self.ids = _(self.ids).difference(ids);
|
||||||
if (self._length) {
|
if (self._length) {
|
||||||
self._length -= 1;
|
self._length -= 1;
|
||||||
|
@ -898,9 +896,7 @@ instance.web.DataSetSearch = instance.web.DataSet.extend({
|
||||||
self.index = self.index <= self.ids.length - 1 ?
|
self.index = self.index <= self.ids.length - 1 ?
|
||||||
self.index : (self.ids.length > 0 ? self.ids.length -1 : 0);
|
self.index : (self.ids.length > 0 ? self.ids.length -1 : 0);
|
||||||
}
|
}
|
||||||
if (callback)
|
});
|
||||||
callback(result);
|
|
||||||
}, error_callback);
|
|
||||||
},
|
},
|
||||||
size: function () {
|
size: function () {
|
||||||
if (this._length !== undefined) {
|
if (this._length !== undefined) {
|
||||||
|
@ -1113,9 +1109,9 @@ instance.web.ProxyDataSet = instance.web.DataSetSearch.extend({
|
||||||
return this._super.apply(this, arguments);
|
return this._super.apply(this, arguments);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
unlink: function(ids, callback, error_callback) {
|
unlink: function(ids) {
|
||||||
if (this.unlink_function) {
|
if (this.unlink_function) {
|
||||||
return this.unlink_function(ids, this._super).then(callback, error_callback);
|
return this.unlink_function(ids, this._super);
|
||||||
} else {
|
} else {
|
||||||
return this._super.apply(this, arguments);
|
return this._super.apply(this, arguments);
|
||||||
}
|
}
|
||||||
|
|
|
@ -359,7 +359,7 @@ instance.web_calendar.CalendarView = instance.web.View.extend({
|
||||||
var self = this,
|
var self = this,
|
||||||
index = this.dataset.get_id_index(event_id);
|
index = this.dataset.get_id_index(event_id);
|
||||||
if (index !== null) {
|
if (index !== null) {
|
||||||
this.dataset.unlink(event_id, function() {
|
this.dataset.unlink(event_id).then(function() {
|
||||||
self.refresh_minical();
|
self.refresh_minical();
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
|
@ -779,7 +779,7 @@ instance.web_view_editor.ViewEditor = instance.web.Widget.extend({
|
||||||
arch.arch = convert_to_utf;
|
arch.arch = convert_to_utf;
|
||||||
this.dataset.write(this.one_object.clicked_tr_view[0] ,{"arch":convert_to_utf}, function(r) {});
|
this.dataset.write(this.one_object.clicked_tr_view[0] ,{"arch":convert_to_utf}, function(r) {});
|
||||||
} else {
|
} else {
|
||||||
this.dataset.unlink([this.one_object.clicked_tr_view[0]],function(res) {});
|
this.dataset.unlink([this.one_object.clicked_tr_view[0]]);
|
||||||
}
|
}
|
||||||
if(move_direct == "add_node"){
|
if(move_direct == "add_node"){
|
||||||
self.add_node_dialog.close();
|
self.add_node_dialog.close();
|
||||||
|
|
Loading…
Reference in New Issue