3
0
Fork 0

[FIX] Issue #906

14.0
QS5ELkMu 2018-07-04 02:30:17 +02:00 committed by Tran Thanh Phuc
parent 3a14a3992c
commit a3d6e5a60e
1 changed files with 3 additions and 6 deletions

View File

@ -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;
}
}
}