summaryrefslogtreecommitdiff
path: root/addons/web/static/src/js/data.js
diff options
context:
space:
mode:
authorChristophe Simonis <chs@openerp.com>2014-01-15 23:13:49 +0100
committerChristophe Simonis <chs@openerp.com>2014-01-15 23:13:49 +0100
commit0e870fc7a7a0359e68fce1a9bc8d9b1a3dd24252 (patch)
tree317e2b763f5a664347cf1981fd72a30890d5cdb5 /addons/web/static/src/js/data.js
parent91aaaec0a5949b6d68066bc7b643835f310fd7d7 (diff)
parent5649e0bbf2350adad07e8ac642cce11ed3922aea (diff)
[MERGE] forward port of branch saas-2 up to revid 3897 dle@openerp.com-20140115121441-bskbyxxbc09ubavh
bzr revid: chs@openerp.com-20140115221349-3lw7b0kpo3f2d04l
Diffstat (limited to 'addons/web/static/src/js/data.js')
-rw-r--r--addons/web/static/src/js/data.js9
1 files changed, 9 insertions, 0 deletions
diff --git a/addons/web/static/src/js/data.js b/addons/web/static/src/js/data.js
index 984ded1fd5e..10ca5d74bd9 100644
--- a/addons/web/static/src/js/data.js
+++ b/addons/web/static/src/js/data.js
@@ -939,6 +939,15 @@ instance.web.BufferedDataSet = instance.web.DataSetStatic.extend({
* @param {Object} id record to remove from the BDS's cache
*/
evict_record: function (id) {
+ // Don't evict records which haven't yet been saved: there is no more
+ // recent data on the server (and there potentially isn't any data),
+ // and this breaks the assumptions of other methods (that the data
+ // for new and altered records is both in the cache and in the to_write
+ // or to_create collection)
+ if (_(this.to_create.concat(this.to_write)).find(function (record) {
+ return record.id === id; })) {
+ return;
+ }
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