[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

Forward-port of 5d17749ff4 which has been
forgotten during previous forward-port.
This commit is contained in:
Nicolas Lempereur
2016-10-27 14:46:08 +02:00
committed by Christophe Simonis
parent 477e69d850
commit 25616b9f2b
+4 -3
View File
@@ -560,11 +560,12 @@ var ListView = View.extend( /** @lends instance.web.ListView# */ {
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);
/* When a record is reloaded, there is a rendering lag because of the addition/suppression of