diff options
| author | Alexandre Kühn <aku@odoo.com> | 2018-04-04 10:09:33 +0200 |
|---|---|---|
| committer | Alexandre Kühn <aku@odoo.com> | 2018-04-05 17:14:57 +0200 |
| commit | 9a9da5763b38a3bce54e9c4870af0032e38cacc3 (patch) | |
| tree | 4743e82dc1c9c3ec545ee213a66b8eeaa90153b6 /addons/web/static/src/js/fields | |
| parent | f8ade1c96d00c5350a10dead129a36d713e2b9a0 (diff) | |
[FIX] web: no record abandon on discard from default_get/onchange
Before this commit, when some records were created from an `onchange`,
we have the following weird behaviour:
Suppose that this record has some required fields that are empty.
When we click on this record, then somewhere else, the record
disappears from the list.
This is because the records contains invalid fields, and it is wrongfully
assuming that the record to be discarded comes from "Add an item".
A previous commit [1] fixed a bit this issue with `default_get`, but since
it relied on a fragile heuristic, we decide to apply the correct fix with
this commit.
[1] https://github.com/odoo/odoo/commit/b09f0c99be2b13d33986414485556d87da186d65
Diffstat (limited to 'addons/web/static/src/js/fields')
| -rw-r--r-- | addons/web/static/src/js/fields/relational_fields.js | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/addons/web/static/src/js/fields/relational_fields.js b/addons/web/static/src/js/fields/relational_fields.js index aa71fca9c25..c4984b69441 100644 --- a/addons/web/static/src/js/fields/relational_fields.js +++ b/addons/web/static/src/js/fields/relational_fields.js @@ -1029,7 +1029,7 @@ var FieldX2Many = AbstractField.extend({ */ _onEditLine: function (ev) { ev.stopPropagation(); - this.trigger_up('freeze_order', {id: this.value.id}); + this.trigger_up('edited_list', { id: this.value.id }); var editedRecord = this.value.data[ev.data.index]; this.renderer.setRowMode(editedRecord.id, 'edit') .done(ev.data.onSuccess); @@ -1117,7 +1117,7 @@ var FieldX2Many = AbstractField.extend({ _onResequence: function (event) { event.stopPropagation(); var self = this; - this.trigger_up('freeze_order', {id: this.value.id}); + this.trigger_up('edited_list', { id: this.value.id }); var rowIDs = event.data.rowIDs.slice(); var rowID = rowIDs.pop(); var defs = _.map(rowIDs, function (rowID, index) { @@ -1261,7 +1261,7 @@ var FieldOne2Many = FieldX2Many.extend({ } } else if (!this.creatingRecord) { this.creatingRecord = true; - this.trigger_up('freeze_order', {id: this.value.id}); + this.trigger_up('edited_list', { id: this.value.id }); this._setValue({ operation: 'CREATE', position: this.editable, |
