From: niv-openerp Date: Tue, 14 Feb 2012 16:15:58 +0000 (+0100) Subject: [fix] complex bug in BufferedDataSet X-Git-Tag: 6.1.0-web~61 X-Git-Url: http://git.inspyration.org/?a=commitdiff_plain;h=cf6b9b6e3e9f0778fe57c8d2fd53f7b9d742290d;p=odoo%2Fodoo.git [fix] complex bug in BufferedDataSet lp bug: https://launchpad.net/bugs/925345 fixed bzr revid: nicolas.vanhoren@openerp.com-20120214161558-k634bkwbwq0vk58p --- diff --git a/addons/web/static/src/js/data.js b/addons/web/static/src/js/data.js index 38119c6..636ad57 100644 --- a/addons/web/static/src/js/data.js +++ b/addons/web/static/src/js/data.js @@ -764,7 +764,7 @@ openerp.web.BufferedDataSet = openerp.web.DataSetStatic.extend({ self.cache.push({id: id, values: record}); } else { // I assume cache value is prioritary - _.defaults(cached.values, record); + cached.values = _.defaults(_.clone(cached.values), record); } }); return_records(); diff --git a/addons/web/static/src/js/view_form.js b/addons/web/static/src/js/view_form.js index ff0ef5e..8c9b99a 100644 --- a/addons/web/static/src/js/view_form.js +++ b/addons/web/static/src/js/view_form.js @@ -2394,13 +2394,13 @@ openerp.web.form.FieldOne2Many = openerp.web.form.Field.extend({ obj['id'] = _.uniqueId(self.dataset.virtual_id_prefix); obj.defaults = {}; self.dataset.to_create.push(obj); - self.dataset.cache.push(_.clone(obj)); + self.dataset.cache.push(_.extend(_.clone(obj), {values: _.clone(command[2])})); ids.push(obj.id); return; case commands.UPDATE: obj['id'] = command[1]; self.dataset.to_write.push(obj); - self.dataset.cache.push(_.clone(obj)); + self.dataset.cache.push(_.extend(_.clone(obj), {values: _.clone(command[2])})); ids.push(obj.id); return; case commands.DELETE: