From 2b1b0e6d13057e5e35625641310ca45f53b583d4 Mon Sep 17 00:00:00 2001 From: Denis Ledoux Date: Tue, 17 Nov 2015 17:04:30 +0100 Subject: [PATCH] [FIX] web: editable list validation with several pages This revision is related to a9d20d9fa04b1dbb350663652e0996e258ac6d31. `dataset.cache` contains an item for each records, even if the records hasn't been loaded in the cache. If a record has not been loaded, only the record id is available, not the other values. Thefore, this isn't possible to validate the record values of records that have not been loaded in the dataset cache. opw-654013 --- addons/web/static/src/js/views/form_relational_widgets.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) 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 3a3c2208e58..d31d923b870 100644 --- a/addons/web/static/src/js/views/form_relational_widgets.js +++ b/addons/web/static/src/js/views/form_relational_widgets.js @@ -961,7 +961,8 @@ var X2ManyListView = ListView.extend({ field.no_rerender = true; current_values[field.name] = field.get('value'); }); - var valid = _.every(this.dataset.cache, function(record){ + var cached_records = _.filter(this.dataset.cache, function(item){return !_.isEmpty(item.values)}); + var valid = _.every(cached_records, function(record){ _.each(fields, function(field){ var value = record.values[field.name]; field.set_value(_.isArray(value) && _.isArray(value[0]) ? [COMMANDS.delete_all()].concat(value) : value);