summaryrefslogtreecommitdiff
path: root/addons/web/static/src
diff options
context:
space:
mode:
authorXavier Morel <xmo@openerp.com>2013-03-01 11:35:43 +0100
committerXavier Morel <xmo@openerp.com>2013-03-01 11:35:43 +0100
commit7278305f6849157f78fc7e1101ece0d2d3d34c68 (patch)
treefd102bc260e30f6cac3311d09084378a18c0a43b /addons/web/static/src
parentb0b1357f164e3ed9d7d89beb0b332017d9f1e396 (diff)
parent8d02a23ee96211c5fc539dc9490220a58e8467e8 (diff)
[FIX] O2M record reloading after workflow progress
Evict record from BufferedDataSet cache as is done with button calls, otherwise when caller reloads record (read) after having executed the workflow action, it'll get the old one back from the BDS's cache. bzr revid: xmo@openerp.com-20130301103543-jra87w2wm417tgyc
Diffstat (limited to 'addons/web/static/src')
-rw-r--r--addons/web/static/src/js/data.js19
1 files changed, 17 insertions, 2 deletions
diff --git a/addons/web/static/src/js/data.js b/addons/web/static/src/js/data.js
index bbff633c687..c5a2bd10888 100644
--- a/addons/web/static/src/js/data.js
+++ b/addons/web/static/src/js/data.js
@@ -860,8 +860,16 @@ instance.web.BufferedDataSet = instance.web.DataSetStatic.extend({
}
return completion.promise();
},
- call_button: function (method, args) {
- var id = args[0][0], index;
+ /**
+ * Invalidates caching of a record in the dataset to ensure the next read
+ * of that record will hit the server.
+ *
+ * Of use when an action is going to remote-alter a record which will then
+ * need to be reloaded, e.g. action button.
+ *
+ * @param {Object} id record to remove from the BDS's cache
+ */
+ evict_record: function (id) {
for(var i=0, len=this.cache.length; i<len; ++i) {
var record = this.cache[i];
// if record we call the button upon is in the cache
@@ -871,8 +879,15 @@ instance.web.BufferedDataSet = instance.web.DataSetStatic.extend({
break;
}
}
+ },
+ call_button: function (method, args) {
+ this.evict_record(args[0][0]);
return this._super(method, args);
},
+ exec_workflow: function (id, signal) {
+ this.evict_record(id);
+ return this._super(id, signal);
+ },
alter_ids: function(n_ids) {
this._super(n_ids);
this.trigger("dataset_changed", n_ids);