[MERGE] trunk-trigger-on_unlink.

bzr revid: vta@openerp.com-20121010143653-wi0yjq91l8ty43uj
This commit is contained in:
vta vta@openerp.com 2012-10-10 16:36:53 +02:00
commit db919af452
2 changed files with 6 additions and 6 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()});
},
/**
@ -690,6 +691,7 @@ instance.web.DataSet = instance.web.CallbackEnabled.extend({
instance.web.DataSetStatic = instance.web.DataSet.extend({
init: function(parent, model, context, ids) {
var self = this;
this._super(parent, model, context);
// all local records
this.ids = ids || [];
@ -711,12 +713,10 @@ instance.web.DataSetStatic = instance.web.DataSet.extend({
}
},
unlink: function(ids) {
this.on_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

@ -4030,7 +4030,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_unlink.add_last(function(ids) {
this.dataset.on('unlink', self, function(ids) {
self.dataset_changed();
});
@ -4163,7 +4163,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_unlink.add_last(function(ids) {
this.dataset.on('unlink', self, function(ids) {
self.dataset_changed();
});