summaryrefslogtreecommitdiff
path: root/addons/web/static/src/js/fields
diff options
context:
space:
mode:
authorMartin Geubelle <mge@odoo.com>2017-09-04 11:36:26 +0200
committerMartin Geubelle <mge@odoo.com>2017-09-06 16:34:18 +0200
commit3052a434947f71955a5e287e373164be46f8860c (patch)
tree1293720a076492bd91172df7bca7b0389d25909f /addons/web/static/src/js/fields
parent64d56995e049d7e7bc3aa7af5a16603220b0d4bc (diff)
[FIX] web: edit editable list view after resequence
In an editable list view with the widget `handle`, resequencing a record and try to edit it afterwards won't work. The selected record isn't the correct one, as if the resequencing had no impact. A small refactoring has been done to fix this because the resequence logic was placed in the ListController (but should logically be placed in the model). Several views are using the resequencing ; the code is thus now placed in the BasicModel. The list renderer state is then updated after the resequence. The resequencing and the line edition have been placed in a common mutex to avoid problems when the user tries to edit a record while the resequence rpc isn't finished yet.
Diffstat (limited to 'addons/web/static/src/js/fields')
-rw-r--r--addons/web/static/src/js/fields/relational_fields.js4
1 files changed, 3 insertions, 1 deletions
diff --git a/addons/web/static/src/js/fields/relational_fields.js b/addons/web/static/src/js/fields/relational_fields.js
index 67218e5decd..9b1e930cef3 100644
--- a/addons/web/static/src/js/fields/relational_fields.js
+++ b/addons/web/static/src/js/fields/relational_fields.js
@@ -684,6 +684,7 @@ var FieldX2Many = AbstractField.extend({
if (command.operation === 'UPDATE' && command.data) {
var state = record.data[this.name];
var fieldNames = state.getFieldNames();
+ this._reset(record, ev);
this.renderer.confirmChange(state, command.id, fieldNames, ev.initialEvent);
return $.when();
}
@@ -871,7 +872,8 @@ var FieldX2Many = AbstractField.extend({
*/
_onEditLine: function (ev) {
ev.stopPropagation();
- this.renderer.setRowMode(ev.data.recordID, 'edit')
+ var editedRecord = this.value.data[ev.data.index];
+ this.renderer.setRowMode(editedRecord.id, 'edit')
.done(ev.data.onSuccess);
},
/**