summaryrefslogtreecommitdiff
path: root/addons/web/static/src/js/views/abstract_renderer.js
diff options
context:
space:
mode:
authorqsm-odoo <qsm@odoo.com>2017-05-04 16:56:57 +0200
committerqsm-odoo <qsm@odoo.com>2017-05-08 14:02:40 +0200
commit0764bc41aa0d28e2a6dcbf6d169d3f8ea092a627 (patch)
tree4d2343bc2f7c856f8badf9d0dc16ff1cdbd04ae8 /addons/web/static/src/js/views/abstract_renderer.js
parentc8d77f93e5a857acd22025f4a8d4d42d674479d1 (diff)
[FIX] web: list rendering was not properly updated after discard
Before this commit, when hitting the "Discard" button in an editable list view, the line switched to readonly mode but with the undiscarded data (even though the data was properly discarded and not saved). Fortunately, the fix is in fact making the save/discard/update system more consistent. Here are some reasons why: - the `_confirmSave` method is now used after a save or a discard (while it was before only called on readonly views where a change was made by a special field widget). - Abandonning a record (discarding a new unsaved one), is now the responsability of `discardChanges` (and not `_setMode`). - The renderer `updateState` method is used when its state is updated. - ... Note that setting the renderer mode is now taking care of deferreds properly (the widgets deferred are now considered when switching a row to readonly/edit mode).
Diffstat (limited to 'addons/web/static/src/js/views/abstract_renderer.js')
-rw-r--r--addons/web/static/src/js/views/abstract_renderer.js7
1 files changed, 5 insertions, 2 deletions
diff --git a/addons/web/static/src/js/views/abstract_renderer.js b/addons/web/static/src/js/views/abstract_renderer.js
index 70ad5350670..7d10f05eab8 100644
--- a/addons/web/static/src/js/views/abstract_renderer.js
+++ b/addons/web/static/src/js/views/abstract_renderer.js
@@ -65,15 +65,18 @@ return Widget.extend({
setLocalState: function (localState) {
},
/**
- * update the state of the view. It always retrigger a full rerender.
+ * Updates the state of the view. It retriggers a full rerender, unless told
+ * otherwise (for optimization for example).
*
* @param {any} state
* @param {Object} params
+ * @param {boolean} [params.noRender=false]
+ * if true, the method only updates the state without rerendering
* @returns {Deferred}
*/
updateState: function (state, params) {
this.state = state;
- return this._render();
+ return params.noRender ? $.when() : this._render();
},
//--------------------------------------------------------------------------