Vidhin Mehta (OpenERP) has proposed merging
lp:~openerp-dev/openerp-web/trunk-trigger-dataset_on_change into lp:openerp-web.
Requested reviews:
OpenERP R&D Web Team (openerp-dev-web)
For more details, see:
https://code.launchpad.net/~openerp-dev/openerp-web/trunk-trigger-dataset_on_change/+merge/129132
Replace callbackenable methods of BufferedDataSet "on_change".
--
https://code.launchpad.net/~openerp-dev/openerp-web/trunk-trigger-dataset_on_change/+merge/129132
Your team OpenERP R&D Team is subscribed to branch
lp:~openerp-dev/openerp-web/trunk-trigger-dataset_on_change.
=== modified file 'addons/web/static/src/js/data.js'
--- addons/web/static/src/js/data.js 2012-10-10 14:36:07 +0000
+++ addons/web/static/src/js/data.js 2012-10-11 09:46:21 +0000
@@ -834,7 +834,7 @@
}
$.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) {
@@ -848,7 +848,7 @@
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) {
@@ -859,8 +859,6 @@
this.cache = [];
this.delete_all = false;
},
- on_change: function() {
- },
read_ids: function (ids, fields, options) {
var self = this;
var to_get = [];
@@ -947,7 +945,7 @@
},
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_.*$/;
=== modified file 'addons/web/static/src/js/view_form.js'
--- addons/web/static/src/js/view_form.js 2012-10-11 00:37:29 +0000
+++ addons/web/static/src/js/view_form.js 2012-10-11 09:46:21 +0000
@@ -3284,7 +3284,7 @@
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();
});
@@ -3581,7 +3581,7 @@
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) {
@@ -3671,7 +3671,7 @@
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() {
_______________________________________________
Mailing list: https://launchpad.net/~openerp-dev-gtk
Post to : [email protected]
Unsubscribe : https://launchpad.net/~openerp-dev-gtk
More help : https://help.launchpad.net/ListHelp