[FIX] web: repair length field in view list

Underscore method _.each expects an array like object when a "length"
property is present.

This was an issue with a record having a numeric "length" field set to a
non-negative value. When changing a line the change would not appear on
blur.

This issue was fixed with 0e664c9e9 but introduced back with f0e331e00.

opw-691070
This commit is contained in:
Nicolas Lempereur 2016-10-21 17:10:57 +02:00
parent 8f484fd137
commit 5d17749ff4
1 changed files with 4 additions and 3 deletions

View File

@ -554,11 +554,12 @@ instance.web.ListView = instance.web.View.extend( /** @lends instance.web.ListVi
self.records.remove(record);
return;
}
_.each(values, function (value, key) {
// _.each is broken if a field "length" is present
for (var key in values) {
if (fields[key] && fields[key].type === 'many2many')
record.set(key + '__display', false, {silent: true});
record.set(key, value, {silent: true});
});
record.set(key, values[key], {silent: true});
}
record.trigger('change', record);
});
},