summaryrefslogtreecommitdiff
path: root/addons/web/static/src/js/data.js
diff options
context:
space:
mode:
authorJiten (OpenERP) <jra@tinyerp.com>2012-10-15 15:27:08 +0530
committerJiten (OpenERP) <jra@tinyerp.com>2012-10-15 15:27:08 +0530
commita757f22ef6e1b6e75cf8033c2acb06a4b5be4425 (patch)
tree445f9d5f51212ce3a1a2e8d5f52720ebbc3eab20 /addons/web/static/src/js/data.js
parent70afbd796e441cce26171af03c26a08f88c3ab52 (diff)
parentfca9f19f76b5c24e5388d6d1d84fd47a09e94233 (diff)
[MERGE] Merged trunk.
bzr revid: jra@tinyerp.com-20121015095708-ogdh38olao58zl3v
Diffstat (limited to 'addons/web/static/src/js/data.js')
-rw-r--r--addons/web/static/src/js/data.js17
1 files changed, 8 insertions, 9 deletions
diff --git a/addons/web/static/src/js/data.js b/addons/web/static/src/js/data.js
index ce85e0ac43f..fe7632d0612 100644
--- a/addons/web/static/src/js/data.js
+++ b/addons/web/static/src/js/data.js
@@ -280,7 +280,8 @@ instance.web.Model = instance.web.Class.extend({
kwargs = args;
args = [];
}
- return instance.session.rpc('/web/dataset/call_kw', {
+ var debug = instance.session.debug ? '/'+this.name+':'+method : '';
+ return instance.session.rpc('/web/dataset/call_kw' + debug, {
model: this.name,
method: method,
args: args,
@@ -567,7 +568,7 @@ instance.web.DataSet = instance.web.CallbackEnabled.extend({
*/
write: function (id, data, options) {
options = options || {};
- return this._model.call('write', [[id], data], {context: this._model.context(options.context)});
+ return this._model.call('write', [[id], data], {context: this._model.context(options.context)}).then(this.trigger('dataset_changed', id, data, options));
},
/**
* Deletes an existing record from the database
@@ -575,8 +576,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()});
+ return this._model.call('unlink', [ids], {context: this._model.context()}).then(this.trigger('dataset_changed', ids));
},
/**
* Calls an arbitrary RPC method
@@ -778,6 +778,7 @@ instance.web.DataSetSearch = instance.web.DataSet.extend({
self.index = self.index <= self.ids.length - 1 ?
self.index : (self.ids.length > 0 ? self.ids.length -1 : 0);
}
+ this.trigger("dataset_changed", ids, callback, error_callback);
});
},
size: function () {
@@ -834,7 +835,7 @@ instance.web.BufferedDataSet = instance.web.DataSetStatic.extend({
}
$.extend(cached.values, record.values);
if (dirty)
- this.on_change();
+ this.trigger("dataset_changed", id, data, options);
return $.Deferred().resolve(true).promise();
},
unlink: function(ids, callback, error_callback) {
@@ -848,7 +849,7 @@ instance.web.BufferedDataSet = instance.web.DataSetStatic.extend({
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_changed", ids, callback, error_callback);
return $.async_when({result: true}).then(callback);
},
reset_ids: function(ids) {
@@ -859,8 +860,6 @@ instance.web.BufferedDataSet = instance.web.DataSetStatic.extend({
this.cache = [];
this.delete_all = false;
},
- on_change: function() {
- },
read_ids: function (ids, fields, options) {
var self = this;
var to_get = [];
@@ -947,7 +946,7 @@ instance.web.BufferedDataSet = instance.web.DataSetStatic.extend({
},
alter_ids: function(n_ids) {
this._super(n_ids);
- this.on_change();
+ this.trigger("dataset_changed", n_ids);
},
});
instance.web.BufferedDataSet.virtual_id_regex = /^one2many_v_id_.*$/;