From bb57b520024e733a6f6ef5e913f8f903f97a2427 Mon Sep 17 00:00:00 2001 From: QS5ELkMu Date: Wed, 4 Jul 2018 02:30:17 +0200 Subject: [PATCH] [FIX] Issue #906 --- .../static/src/js/web_tree_dynamic_colored_field.js | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/web_tree_dynamic_colored_field/static/src/js/web_tree_dynamic_colored_field.js b/web_tree_dynamic_colored_field/static/src/js/web_tree_dynamic_colored_field.js index d9e14c11..334db537 100644 --- a/web_tree_dynamic_colored_field/static/src/js/web_tree_dynamic_colored_field.js +++ b/web_tree_dynamic_colored_field/static/src/js/web_tree_dynamic_colored_field.js @@ -17,15 +17,12 @@ odoo.define('web_tree_dynamic_colored_field', function (require) { if (colorAttr.length > 0) { var colorField = colorAttr[0].split(':')[1].trim(); // validate the presence of that field in tree view - var fieldNames = _(this.columns).map( - (value) => { return value.attrs.name; } - ); - if (fieldNames.indexOf(colorField) === -1) { + if (this.state.data.length && colorField in this.state.data[0].data) { + this.colorField = colorField; + } else { console.warn( "No field named '" + colorField + "' present in view." ); - } else { - this.colorField = colorField; } } }