summaryrefslogtreecommitdiff
path: root/addons/web/static/src/js/fields
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/fields
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/fields')
-rw-r--r--addons/web/static/src/js/fields/relational_fields.js9
1 files changed, 5 insertions, 4 deletions
diff --git a/addons/web/static/src/js/fields/relational_fields.js b/addons/web/static/src/js/fields/relational_fields.js
index 135d21e5adf..51986224c78 100644
--- a/addons/web/static/src/js/fields/relational_fields.js
+++ b/addons/web/static/src/js/fields/relational_fields.js
@@ -638,7 +638,7 @@ var FieldX2Many = AbstractField.extend({
return this._super();
}
if (this.renderer) {
- this.renderer.updateState(this.value);
+ this.renderer.updateState(this.value, {});
this.pager.updateState({ size: this.value.count });
return $.when();
}
@@ -746,8 +746,8 @@ var FieldX2Many = AbstractField.extend({
onFailure: def.reject.bind(def),
});
} else {
- self.renderer.setRowMode(recordID, 'readonly');
- def.resolve();
+ self.renderer.setRowMode(recordID, 'readonly')
+ .done(def.resolve.bind(def));
}
});
return def;
@@ -791,7 +791,8 @@ var FieldX2Many = AbstractField.extend({
*/
_onEditLine: function (ev) {
ev.stopPropagation();
- this.renderer.setRowMode(ev.data.recordID, 'edit');
+ this.renderer.setRowMode(ev.data.recordID, 'edit')
+ .done(ev.data.onSuccess);
},
/**
* Updates the given record with the changes.