diff options
| author | Géry Debongnie <ged@odoo.com> | 2017-09-19 15:53:24 +0200 |
|---|---|---|
| committer | Géry Debongnie <ged@odoo.com> | 2017-09-20 10:05:13 +0200 |
| commit | 48b8be29fa1e8c10f2ce652a768d3dcb581a53a2 (patch) | |
| tree | 81a5103889e40323b35bdbabd8c04dae6c645747 /addons/web/static/src/js/fields/relational_fields.js | |
| parent | 3136fc1643996f319faf500e303f586d18908010 (diff) | |
[FIX] web: update x2manys when onchange add new line
In this commit, we make sure that if an onchange in a x2many modifies
another line, then the new data is properly shown. This is quite
tricky, because the field x2many ignores the full extent of the changes.
Also, we obviously want to preserve the editing state (focused field,
...)
So, what we actually do is to rerender the full x2many (minus the new
line) to make sure that we preserve the correct row order.
Note: thanks to MGE for the test and some preliminary work.
Diffstat (limited to 'addons/web/static/src/js/fields/relational_fields.js')
| -rw-r--r-- | addons/web/static/src/js/fields/relational_fields.js | 13 |
1 files changed, 6 insertions, 7 deletions
diff --git a/addons/web/static/src/js/fields/relational_fields.js b/addons/web/static/src/js/fields/relational_fields.js index 7df5b390a2c..90c2b08e1e5 100644 --- a/addons/web/static/src/js/fields/relational_fields.js +++ b/addons/web/static/src/js/fields/relational_fields.js @@ -681,17 +681,16 @@ var FieldX2Many = AbstractField.extend({ var command = ev.data.changes[this.name]; // Here, we only consider 'UPDATE' commands with data, which occur // with editable list view. In order to keep the current line in - // edition, we call confirmChange which will reset the widgets - // instead of re-rendering the list. 'UPDATE' commands with no data - // can be ignored: they occur in one2manys when the record is - // updated from a dialog and in this case, we can re-render the - // whole subview. + // edition, we call confirmUpdate which will try to reset the widgets + // of the line being edited, and rerender the rest of the list. + // 'UPDATE' commands with no data can be ignored: they occur in + // one2manys when the record is updated from a dialog and in this + // case, we can re-render the whole subview. 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(); + return this.renderer.confirmUpdate(state, command.id, fieldNames, ev.initialEvent); } } return this._super.apply(this, arguments); |
