forked from Techsystech/web
web_tree_dynamic_colored_field: Assume that color may not start with 'color_field'
The index at 0 in the following code: var colorField = this.arch.attrs.colors.split(';') .filter(color => color.trim().startsWith('color_field'))[0] Was failing on such valid xml: <tree string="Buffer monitor" colors="red:procure_recommended_qty > 0">15.0-ocabot-merge-pr-2789-by-pedrobaeza-bump-patch
parent
46bc1f4de0
commit
583df6899a
|
@ -12,10 +12,10 @@ odoo.define('web_tree_dynamic_colored_field', function (require) {
|
||||||
*/
|
*/
|
||||||
_renderBody: function () {
|
_renderBody: function () {
|
||||||
if (this.arch.attrs.colors) {
|
if (this.arch.attrs.colors) {
|
||||||
var colorField = this.arch.attrs.colors.split(';')
|
var colorAttr = this.arch.attrs.colors.split(';')
|
||||||
.filter(color => color.trim().startsWith('color_field'))[0]
|
.filter(color => color.trim().startsWith('color_field'));
|
||||||
.split(':')[1]
|
if (colorAttr.length > 0) {
|
||||||
.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(
|
var fieldNames = _(this.columns).map(
|
||||||
(value) => { return value.attrs.name; }
|
(value) => { return value.attrs.name; }
|
||||||
|
@ -28,6 +28,7 @@ odoo.define('web_tree_dynamic_colored_field', function (require) {
|
||||||
this.colorField = colorField;
|
this.colorField = colorField;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
return this._super();
|
return this._super();
|
||||||
},
|
},
|
||||||
/**
|
/**
|
||||||
|
|
Loading…
Reference in New Issue