}
$.extend(cached.values, record.values);
if (dirty)
- this.on_change();
+ this.trigger("dataset_on_change");
return $.Deferred().resolve(true).promise();
},
unlink: function(ids, callback, error_callback) {
this.to_write = _.reject(this.to_write, function(x) { return _.include(ids, x.id);});
this.cache = _.reject(this.cache, function(x) { return _.include(ids, x.id);});
this.set_ids(_.without.apply(_, [this.ids].concat(ids)));
- this.on_change();
+ this.trigger("dataset_on_change");
return $.async_when({result: true}).then(callback);
},
reset_ids: function(ids) {
this.cache = [];
this.delete_all = false;
},
- on_change: function() {
- },
read_ids: function (ids, fields, options) {
var self = this;
var to_get = [];
},
alter_ids: function(n_ids) {
this._super(n_ids);
- this.on_change();
+ this.trigger("dataset_on_change");
},
});
instance.web.BufferedDataSet.virtual_id_regex = /^one2many_v_id_.*$/;
this.dataset.o2m = this;
this.dataset.parent_view = this.view;
this.dataset.child_name = this.name;
- this.dataset.on_change.add_last(function() {
+ this.dataset.on('dataset_on_change', this, function() {
self.trigger_on_change();
});
create_function: function(data) {
return self.o2m.dataset.create(data).then(function(r) {
self.o2m.dataset.set_ids(self.o2m.dataset.ids.concat([r]));
- self.o2m.dataset.on_change();
+ self.o2m.dataset.trigger("dataset_on_change");
});
},
write_function: function(id, data, options) {
create_function: function(data, callback, error_callback) {
return self.o2m.dataset.create(data).then(function(r) {
self.o2m.dataset.set_ids(self.o2m.dataset.ids.concat([r]));
- self.o2m.dataset.on_change();
+ self.o2m.dataset.trigger("dataset_on_change");
}).then(callback, error_callback);
},
read_function: function() {