Browse Source
Merge pull request #979 from Tardo/fix_#906
[FIX][11.0][web_tree_dynamic_colored_field] Issue #906
pull/1013/head
Pedro M. Baeza
6 years ago
committed by
GitHub
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with
3 additions and
6 deletions
-
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) { |
|
|
if (colorAttr.length > 0) { |
|
|
var colorField = colorAttr[0].split(':')[1].trim(); |
|
|
var colorField = colorAttr[0].split(':')[1].trim(); |
|
|
// validate the presence of that field in tree view
|
|
|
// 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( |
|
|
console.warn( |
|
|
"No field named '" + colorField + "' present in view." |
|
|
"No field named '" + colorField + "' present in view." |
|
|
); |
|
|
); |
|
|
} else { |
|
|
|
|
|
this.colorField = colorField; |
|
|
|
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|