From d0f321d6cc198045ff796865d94ddd15bd6d0b99 Mon Sep 17 00:00:00 2001 From: Aaron Bohy Date: Wed, 5 Apr 2017 11:32:56 +0200 Subject: [FIX] web: Form: don't discard onchange when editing a o2m Assume that there is an onchange on a form view that upates the records of a one2many field. Before this rev., if the user edited one of those one2many records (in a dialog) after the onchange, the onchange values were lost. --- addons/web/static/src/js/views/basic/basic_model.js | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'addons/web/static/src/js/views/basic/basic_model.js') diff --git a/addons/web/static/src/js/views/basic/basic_model.js b/addons/web/static/src/js/views/basic/basic_model.js index 47d5cee5c9c..c71ac81e0d9 100644 --- a/addons/web/static/src/js/views/basic/basic_model.js +++ b/addons/web/static/src/js/views/basic/basic_model.js @@ -504,6 +504,8 @@ var BasicModel = AbstractModel.extend({ * * @param {string} id local id for a resource * @param {Object} [options] + * @param {boolean} [options.keepChanges=false] if true, doesn't discard the + * changes on the record before reloading it * @returns {Deferred -> string} resolves to the id of the resource */ reload: function (id, options) { @@ -520,7 +522,9 @@ var BasicModel = AbstractModel.extend({ }; return this._makeDefaultRecord(element.model, params); } - this.discardChanges(id); + if (!options.keepChanges) { + this.discardChanges(id); + } } if (options.context !== undefined) { -- cgit v1.2.3