diff options
| author | qsm-odoo <qsm@odoo.com> | 2017-03-20 17:18:53 +0100 |
|---|---|---|
| committer | qsm-odoo <qsm@odoo.com> | 2017-03-21 11:55:45 +0100 |
| commit | 3aabf8101a74ccaf0403f5c4fc94c2901a9e951d (patch) | |
| tree | c3a0b0e8ccef78997e0f158589982c62c4fe4a1e /addons/web/static/src | |
| parent | 1cefe8d78727549fd86661a946cbf275dd1a86b6 (diff) | |
[FIX] web: correctly check editable list validity
The editable list has a `is_valid` method which checks that all the
records it contains have valid data. The problem is that it was
considering that all the records in the `dataset.cache` were part of
the x2x field the editable list is working with. This is wrong as the
`dataset.cache` can contain information which are not part of the
editable list anymore.
See the commit which introduced the use of the `dataset.cache`:
a9d20d9fa04b1dbb350663652e0996e258ac6d31
This was causing issues with rare cases of an editable list which
contains another editable list (even invisible) which was sharing
common information with its parent editable list.
opw-710627
Diffstat (limited to 'addons/web/static/src')
| -rw-r--r-- | addons/web/static/src/js/views/form_relational_widgets.js | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/addons/web/static/src/js/views/form_relational_widgets.js b/addons/web/static/src/js/views/form_relational_widgets.js index 6a6c258f8f9..2517b3c57b8 100644 --- a/addons/web/static/src/js/views/form_relational_widgets.js +++ b/addons/web/static/src/js/views/form_relational_widgets.js @@ -959,7 +959,8 @@ var X2ManyListView = ListView.extend({ field.no_rerender = true; current_values[field.name] = field.get('value'); }); - var cached_records = _.filter(this.dataset.cache, function(item){return !_.isEmpty(item.values) && !item.to_delete;}); + var ids = _.map(this.records.records, function (item) { return item.attributes.id; }); + var cached_records = _.filter(this.dataset.cache, function(item){return _.contains(ids, item.id) && !_.isEmpty(item.values) && !item.to_delete;}); var valid = _.every(cached_records, function(record){ _.each(fields, function(field){ var value = record.values[field.name]; |
