diff options
| author | Fabien Meghazi <fme@openerp.com> | 2014-01-16 19:15:19 +0100 |
|---|---|---|
| committer | Fabien Meghazi <fme@openerp.com> | 2014-01-16 19:15:19 +0100 |
| commit | c0dda700f19ca3452db7dfb9eef1517299f8e8f0 (patch) | |
| tree | f71da9acdc2d0f6c7af6b9559df87a5329f99c03 /addons/web/static/src/js/data.js | |
| parent | 4b663489a6a922e579e00fabbb0e3129dcf9ecc5 (diff) | |
| parent | 153df3aeacfce1a184bf3930376435bd691d19a3 (diff) | |
[MERGE] upstream
bzr revid: fme@openerp.com-20140116181519-xtzhzm7u98u6xz18
Diffstat (limited to 'addons/web/static/src/js/data.js')
| -rw-r--r-- | addons/web/static/src/js/data.js | 9 |
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 |
