Skip to content

Commit

Permalink
[FIX] web: repair length field in view list
Browse files Browse the repository at this point in the history
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 0e664c9 but introduced back with f0e331e.

opw-691070

Forward-port of 5d17749 which has been
forgotten during previous forward-port.
  • Loading branch information
nle-odoo authored and KangOl committed Oct 27, 2016
1 parent 477e69d commit 25616b9
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions addons/web/static/src/js/views/list_view.js
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 25616b9

Please sign in to comment.