diff options
| author | Aaron Bohy <aab@odoo.com> | 2017-05-16 15:02:58 +0200 |
|---|---|---|
| committer | Aaron Bohy <aab@odoo.com> | 2017-05-17 08:10:49 +0200 |
| commit | 0f9e986c468702ebe55860895ef8d8b84c90a48c (patch) | |
| tree | 27ed0b34170d26560fd253d5fdbf1330dbd5055e /addons/web/static/src/js/views | |
| parent | 5afe894f440eff3b58134d14fa7c9b43b19fe88b (diff) | |
[FIX] web: BasicModel: discard changes when reloading
... from a new record.
Steps to reproduce the issue:
- go to a multi-record view (e.g. list) of basically any model
- click on 'Create' -> it opens a form view in edit mode
- click on 'Discard' -> it goes back to the list
- click on an existing record -> it should open the selected
record in readonly.
However, it didn't display the data of the selected record, but
the default data of a new record (the result of a default_get).
This was because the changes weren't properly discarded when
reloading from a new record (it rather restored the record to its
initial state, i.e. to the result of the default_get).
Diffstat (limited to 'addons/web/static/src/js/views')
| -rw-r--r-- | addons/web/static/src/js/views/basic/basic_model.js | 4 |
1 files changed, 2 insertions, 2 deletions
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 5e5b36472f5..a55d2b2723b 100644 --- a/addons/web/static/src/js/views/basic/basic_model.js +++ b/addons/web/static/src/js/views/basic/basic_model.js @@ -228,7 +228,7 @@ var BasicModel = AbstractModel.extend({ options = options || {}; var element = this.localData[id]; var isNew = this.isNew(id); - var rollback = options.rollback || isNew; + var rollback = 'rollback' in options ? options.rollback : isNew; this._visitChildren(element, function (elem) { if (rollback && elem._savePoint) { if (elem._savePoint instanceof Array) { @@ -644,7 +644,7 @@ var BasicModel = AbstractModel.extend({ return this._makeDefaultRecord(element.model, params); } if (!options.keepChanges) { - this.discardChanges(id); + this.discardChanges(id, {rollback: false}); } } |
