diff --git a/web_tree_dynamic_colored_field/__manifest__.py b/web_tree_dynamic_colored_field/__manifest__.py
index 3cda70693..3fc8257fc 100644
--- a/web_tree_dynamic_colored_field/__manifest__.py
+++ b/web_tree_dynamic_colored_field/__manifest__.py
@@ -4,7 +4,7 @@
"name": "Colorize field in tree views",
"summary": "Allows you to dynamically color fields on tree views",
"category": "Hidden/Dependency",
- "version": "12.0.1.0.0",
+ "version": "13.0.1.0.0",
"depends": ["web"],
"author": "Camptocamp, Therp BV, Odoo Community Association (OCA)",
"license": "AGPL-3",
diff --git a/web_tree_dynamic_colored_field/demo/res_users.xml b/web_tree_dynamic_colored_field/demo/res_users.xml
index ef364722f..dd8afbb00 100644
--- a/web_tree_dynamic_colored_field/demo/res_users.xml
+++ b/web_tree_dynamic_colored_field/demo/res_users.xml
@@ -5,7 +5,7 @@
- color_field: lang
+ {"color_field": "lang"}
{
diff --git a/web_tree_dynamic_colored_field/readme/DESCRIPTION.rst b/web_tree_dynamic_colored_field/readme/DESCRIPTION.rst
index c3f632caa..c9ae98dcf 100644
--- a/web_tree_dynamic_colored_field/readme/DESCRIPTION.rst
+++ b/web_tree_dynamic_colored_field/readme/DESCRIPTION.rst
@@ -1,10 +1,10 @@
This module aims to add support for dynamically coloring fields in tree view
according to data in the record.
-It provides attributes on fields with the similar syntax as the ``colors`` attribute
+It provides attributes on fields with a similar syntax as the ``colors`` attribute
in tree tags.
-Further, it provides a ``color_field`` attribute on tree tags's ``colors`` to use
+Further, it provides a ``color_field`` attribute on tree tags's ``options`` to use
a field's value as color.
Features
@@ -12,4 +12,4 @@ Features
* Add attribute ``bg_color`` on field's ``options`` to color background of a cell in tree view
* Add attribute ``fg_color`` on field's ``options`` to change text color of a cell in tree view
-* Add attribute ``color_field`` on the tree element's ``colors`` to use as color
+* Add attribute ``color_field`` on the tree element's ``options`` to use as color
diff --git a/web_tree_dynamic_colored_field/readme/USAGE.rst b/web_tree_dynamic_colored_field/readme/USAGE.rst
index 921a3262c..101802d9b 100644
--- a/web_tree_dynamic_colored_field/readme/USAGE.rst
+++ b/web_tree_dynamic_colored_field/readme/USAGE.rst
@@ -26,11 +26,11 @@
With this example, column which renders 'name' field will have its text colored in white on a customer records.
-* In the tree view declaration, use ``options='"color_field": "my_color"'`` attribute in the ``tree`` tag::
+* In the tree view declaration, use ``options='{"color_field": "my_color"}'`` attribute in the ``tree`` tag::
...
-
+
...
...
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 b1aa0407c..f2a4f99a6 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
@@ -11,11 +11,14 @@ odoo.define('web_tree_dynamic_colored_field', function (require) {
* @override
*/
_renderBody: function () {
- if (this.arch.attrs.colors) {
- var colorAttr = this.arch.attrs.colors.split(';');
- if (colorAttr.length > 0) {
- var colorField = colorAttr[0].split(':')[1].trim();
- // validate the presence of that field in tree view
+ if (this.arch.attrs.options) {
+ var archOptions = this.arch.attrs.options;
+ if (!_.isObject(archOptions)) {
+ archOptions = pyUtils.py_eval(archOptions);
+ }
+ var colorField = archOptions.color_field;
+ if (colorField) {
+ // Validate the presence of that field in tree view
if (this.state.data.length && colorField in this.state.data[0].data) {
this.colorField = colorField;
} else {