[FIX] on_unlink.

bzr revid: vta@openerp.com-20121010143607-nv3lhmy8r27m1ls9
This commit is contained in:
vta vta@openerp.com 2012-10-10 16:36:07 +02:00
parent 5ab21e13a3
commit 6b509ab8ea
2 changed files with 5 additions and 7 deletions

View File

@ -575,6 +575,7 @@ instance.web.DataSet = instance.web.CallbackEnabled.extend({
* @param {Number|String} ids identifier of the record to delete
*/
unlink: function(ids) {
this.trigger('unlink', ids);
return this._model.call('unlink', [ids], {context: this._model.context()});
},
/**
@ -694,7 +695,6 @@ instance.web.DataSetStatic = instance.web.DataSet.extend({
this._super(parent, model, context);
// all local records
this.ids = ids || [];
self.on("on_rec_unlink", self, self.on_unlink);
},
read_slice: function (fields, options) {
options = options || {};
@ -713,12 +713,10 @@ instance.web.DataSetStatic = instance.web.DataSet.extend({
}
},
unlink: function(ids) {
this.trigger('on_rec_unlink', ids);
this.set_ids(_.without.apply(null, [this.ids].concat(ids)));
this.trigger('unlink', ids);
return $.Deferred().resolve({result: true});
},
on_unlink: function(ids) {
this.set_ids(_.without.apply(null, [this.ids].concat(ids)));
}
});
instance.web.DataSetSearch = instance.web.DataSet.extend({

View File

@ -3998,7 +3998,7 @@ instance.web.form.FieldMany2Many = instance.web.form.AbstractField.extend({
this.dataset = new instance.web.form.Many2ManyDataSet(this, this.field.relation);
this.dataset.m2m = this;
this.dataset.on('on_rec_unlink', self, function(ids) {
this.dataset.on('unlink', self, function(ids) {
self.dataset_changed();
});
@ -4131,7 +4131,7 @@ instance.web.form.FieldMany2ManyKanban = instance.web.form.AbstractField.extend(
this.dataset = new instance.web.form.Many2ManyDataSet(this, this.field.relation);
this.dataset.m2m = this;
this.dataset.on('on_rec_unlink', self, function(ids) {
this.dataset.on('unlink', self, function(ids) {
self.dataset_changed();
});