[IMP] web_tree_dynamic_colored_field: pre-commit auto fixes (before v17)

pull/3107/head
jurgis 2024-03-12 13:57:23 +02:00 committed by Enric Tobella
parent 3fa3e94ee3
commit 4c780be3d5
12 changed files with 265 additions and 205 deletions

View File

@ -17,25 +17,27 @@ Colorize field in tree views
:target: http://www.gnu.org/licenses/agpl-3.0-standalone.html :target: http://www.gnu.org/licenses/agpl-3.0-standalone.html
:alt: License: AGPL-3 :alt: License: AGPL-3
.. |badge3| image:: https://img.shields.io/badge/github-OCA%2Fweb-lightgray.png?logo=github .. |badge3| image:: https://img.shields.io/badge/github-OCA%2Fweb-lightgray.png?logo=github
:target: https://github.com/OCA/web/tree/15.0/web_tree_dynamic_colored_field :target: https://github.com/OCA/web/tree/17.0/web_tree_dynamic_colored_field
:alt: OCA/web :alt: OCA/web
.. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png .. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png
:target: https://translation.odoo-community.org/projects/web-15-0/web-15-0-web_tree_dynamic_colored_field :target: https://translation.odoo-community.org/projects/web-17-0/web-17-0-web_tree_dynamic_colored_field
:alt: Translate me on Weblate :alt: Translate me on Weblate
.. |badge5| image:: https://img.shields.io/badge/runboat-Try%20me-875A7B.png .. |badge5| image:: https://img.shields.io/badge/runboat-Try%20me-875A7B.png
:target: https://runboat.odoo-community.org/builds?repo=OCA/web&target_branch=15.0 :target: https://runboat.odoo-community.org/builds?repo=OCA/web&target_branch=17.0
:alt: Try me on Runboat :alt: Try me on Runboat
|badge1| |badge2| |badge3| |badge4| |badge5| |badge1| |badge2| |badge3| |badge4| |badge5|
This module aims to add support for dynamically coloring fields in tree view This module aims to add support for dynamically coloring fields in tree
according to data in the record. view according to data in the record.
Features Features
======== --------
* Add attribute ``bg_color`` on field's ``options`` to color background of a cell in tree view - Add attribute ``bg_color`` on field's ``options`` to color background
* Add attribute ``fg_color`` on field's ``options`` to change text color of a cell in tree view of a cell in tree view
- Add attribute ``fg_color`` on field's ``options`` to change text
color of a cell in tree view
**Table of contents** **Table of contents**
@ -45,7 +47,11 @@ Features
Usage Usage
===== =====
* In the tree view declaration, put ``options='{"bg_color": "red: customer==True"}`` attribute in the ``field`` tag:: - In the tree view declaration, put
``options='{"bg_color": "red: customer==True"}`` attribute in the
``field`` tag:
::
... ...
<field name="arch" type="xml"> <field name="arch" type="xml">
@ -59,7 +65,11 @@ Usage
With this example, column which renders 'name' field will have its background colored in red. With this example, column which renders 'name' field will have its background colored in red.
* In the tree view declaration, put ``options='{"fg_color": "white:customer == True"}'`` attribute in the ``field`` tag:: - In the tree view declaration, put
``options='{"fg_color": "white:customer == True"}'`` attribute in the
``field`` tag:
::
... ...
<field name="arch" type="xml"> <field name="arch" type="xml">
@ -73,7 +83,11 @@ Usage
With this example, column which renders 'name' field will have its text colored in white on a customer records. 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:
::
... ...
<field name="arch" type="xml"> <field name="arch" type="xml">
@ -85,12 +99,13 @@ Usage
</field> </field>
... ...
* You can also use ``colors="bg_color_field: my_color"`` to defined the field name that will be used - You can also use ``colors="bg_color_field: my_color"`` to defined the
for the background color of the line. field name that will be used for the background color of the line.
* If you want to use more than one color, you can split the attributes using ';': - If you want to use more than one color, you can split the attributes
using ';':
.. code:: ::
options='{"fg_color": "red:red_color == True; green:green_color == True"}' options='{"fg_color": "red:red_color == True; green:green_color == True"}'
@ -114,7 +129,11 @@ Example:
overrides the rest of `colors` attributes, and that you need the tree overrides the rest of `colors` attributes, and that you need the tree
to load your field in the first place by adding it as invisible field. to load your field in the first place by adding it as invisible field.
* Can use strings too... In the tree view declaration, put ``options="{'fg_color': 'green:customer_state == \'success\''}"`` attribute in the ``field`` tag:: - Can use strings too... In the tree view declaration, put
``options="{'fg_color': 'green:customer_state == \'success\''}"``
attribute in the ``field`` tag:
::
... ...
<field name="arch" type="xml"> <field name="arch" type="xml">
@ -126,16 +145,19 @@ Example:
</field> </field>
... ...
**Note that you can use single or normal quotes. If the declaration of the options doesn't follow the JSON format, the options string will be evaluated using py.eval()** **Note that you can use single or normal quotes. If the declaration of
the options doesn't follow the JSON format, the options string will be
evaluated using py.eval()**
Known issues / Roadmap Known issues / Roadmap
====================== ======================
* Before version 13.0, this module had a feature allowing to change the color of - Before version 13.0, this module had a feature allowing to change the
a line depending on a field, using a ``colors`` attribute with the name of the color of a line depending on a field, using a ``colors`` attribute
field on the ``<tree>`` element. Since 13.0, the ``colors`` attribute is no with the name of the field on the ``<tree>`` element. Since 13.0, the
longer in the RelaxNG schema of the tree view, so we can't use it anymore. ``colors`` attribute is no longer in the RelaxNG schema of the tree
This feature has then been dropped, but could be reimplement in another way. view, so we can't use it anymore. This feature has then been dropped,
but could be reimplement in another way.
Bug Tracker Bug Tracker
=========== ===========
@ -143,7 +165,7 @@ Bug Tracker
Bugs are tracked on `GitHub Issues <https://github.com/OCA/web/issues>`_. Bugs are tracked on `GitHub Issues <https://github.com/OCA/web/issues>`_.
In case of trouble, please check there if your issue has already been reported. In case of trouble, please check there if your issue has already been reported.
If you spotted it first, help us to smash it by providing a detailed and welcomed If you spotted it first, help us to smash it by providing a detailed and welcomed
`feedback <https://github.com/OCA/web/issues/new?body=module:%20web_tree_dynamic_colored_field%0Aversion:%2015.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**>`_. `feedback <https://github.com/OCA/web/issues/new?body=module:%20web_tree_dynamic_colored_field%0Aversion:%2017.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**>`_.
Do not contact contributors directly about support or help with technical issues. Do not contact contributors directly about support or help with technical issues.
@ -151,30 +173,30 @@ Credits
======= =======
Authors Authors
~~~~~~~ -------
* Camptocamp * Camptocamp
* Therp BV * Therp BV
Contributors Contributors
~~~~~~~~~~~~ ------------
* Damien Crier <damien.crier@camptocamp.com> - Damien Crier <damien.crier@camptocamp.com>
* Holger Brunn <hbrunn@therp.nl> - Holger Brunn <hbrunn@therp.nl>
* Artem Kostyuk <a.kostyuk@mobilunity.com> - Artem Kostyuk <a.kostyuk@mobilunity.com>
* Guewen Baconnier <guewen.baconnier@camptocamp.com> - Guewen Baconnier <guewen.baconnier@camptocamp.com>
* Phuc Tran Thanh <phuc@trobz.com> - Phuc Tran Thanh <phuc@trobz.com>
* Sylvain LE GAL <https://twitter.com/legalsylvain> - Sylvain LE GAL <https://twitter.com/legalsylvain>
Other credits Other credits
~~~~~~~~~~~~~ -------------
The development of this module has been financially supported by: The development of this module has been financially supported by:
* Camptocamp - Camptocamp
Maintainers Maintainers
~~~~~~~~~~~ -----------
This module is maintained by the OCA. This module is maintained by the OCA.
@ -186,6 +208,6 @@ OCA, or the Odoo Community Association, is a nonprofit organization whose
mission is to support the collaborative development of Odoo features and mission is to support the collaborative development of Odoo features and
promote its widespread use. promote its widespread use.
This module is part of the `OCA/web <https://github.com/OCA/web/tree/15.0/web_tree_dynamic_colored_field>`_ project on GitHub. This module is part of the `OCA/web <https://github.com/OCA/web/tree/17.0/web_tree_dynamic_colored_field>`_ project on GitHub.
You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute. You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.

View File

@ -0,0 +1,3 @@
[build-system]
requires = ["whool"]
build-backend = "whool.buildapi"

View File

@ -0,0 +1,6 @@
- Damien Crier \<<damien.crier@camptocamp.com>\>
- Holger Brunn \<<hbrunn@therp.nl>\>
- Artem Kostyuk \<<a.kostyuk@mobilunity.com>\>
- Guewen Baconnier \<<guewen.baconnier@camptocamp.com>\>
- Phuc Tran Thanh \<<phuc@trobz.com>\>
- Sylvain LE GAL \<<https://twitter.com/legalsylvain>\>

View File

@ -1,6 +0,0 @@
* Damien Crier <damien.crier@camptocamp.com>
* Holger Brunn <hbrunn@therp.nl>
* Artem Kostyuk <a.kostyuk@mobilunity.com>
* Guewen Baconnier <guewen.baconnier@camptocamp.com>
* Phuc Tran Thanh <phuc@trobz.com>
* Sylvain LE GAL <https://twitter.com/legalsylvain>

View File

@ -1,3 +1,3 @@
The development of this module has been financially supported by: The development of this module has been financially supported by:
* Camptocamp - Camptocamp

View File

@ -0,0 +1,9 @@
This module aims to add support for dynamically coloring fields in tree
view according to data in the record.
## 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

View File

@ -1,8 +0,0 @@
This module aims to add support for dynamically coloring fields in tree view
according to data in the record.
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

View File

@ -0,0 +1,6 @@
- Before version 13.0, this module had a feature allowing to change the
color of a line depending on a field, using a `colors` attribute with
the name of the field on the `<tree>` element. Since 13.0, the
`colors` attribute is no longer in the RelaxNG schema of the tree
view, so we can't use it anymore. This feature has then been dropped,
but could be reimplement in another way.

View File

@ -1,5 +0,0 @@
* Before version 13.0, this module had a feature allowing to change the color of
a line depending on a field, using a ``colors`` attribute with the name of the
field on the ``<tree>`` element. Since 13.0, the ``colors`` attribute is no
longer in the RelaxNG schema of the tree view, so we can't use it anymore.
This feature has then been dropped, but could be reimplement in another way.

View File

@ -0,0 +1,92 @@
- In the tree view declaration, put
`options='{"bg_color": "red: customer==True"}` attribute in the
`field` tag:
...
<field name="arch" type="xml">
<tree string="View name">
...
<field name="name" options='{"bg_color": "red: customer == True"}'/>
...
</tree>
</field>
...
With this example, column which renders 'name' field will have its background colored in red.
- In the tree view declaration, put
`options='{"fg_color": "white:customer == True"}'` attribute in the
`field` tag:
...
<field name="arch" type="xml">
<tree string="View name">
...
<field name="name" options='{"fg_color": "white:customer == True"}'/>
...
</tree>
</field>
...
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:
...
<field name="arch" type="xml">
<tree string="View name" colors="color_field: my_color" >
...
<field name="my_color" invisible="1"/>
...
</tree>
</field>
...
- You can also use `colors="bg_color_field: my_color"` to defined the
field name that will be used for the background color of the line.
- If you want to use more than one color, you can split the attributes
using ';':
```
options='{"fg_color": "red:red_color == True; green:green_color == True"}'
```
Example:
``` xml
...
<field name="arch" type="xml">
<tree string="View name">
...
<field name="name" options='{"fg_color": "red:red_color == True; green:green_color == True"}'/>
...
</tree>
</field>
...
With this example, the content of the field named `my_color` will be used to
populate the `my_color` CSS value. Use a function field to return whichever
color you want depending on the other record values. Note that this
overrides the rest of `colors` attributes, and that you need the tree
to load your field in the first place by adding it as invisible field.
```
- Can use strings too... In the tree view declaration, put
`options="{'fg_color': 'green:customer_state == \'success\''}"`
attribute in the `field` tag:
...
<field name="arch" type="xml">
<tree string="View name">
...
<field name="name" options="{'fg_color': 'green:customer_state == \'success\''}"/>
...
</tree>
</field>
...
**Note that you can use single or normal quotes. If the declaration of
the options doesn't follow the JSON format, the options string will be
evaluated using py.eval()**

View File

@ -1,82 +0,0 @@
* In the tree view declaration, put ``options='{"bg_color": "red: customer==True"}`` attribute in the ``field`` tag::
...
<field name="arch" type="xml">
<tree string="View name">
...
<field name="name" options='{"bg_color": "red: customer == True"}'/>
...
</tree>
</field>
...
With this example, column which renders 'name' field will have its background colored in red.
* In the tree view declaration, put ``options='{"fg_color": "white:customer == True"}'`` attribute in the ``field`` tag::
...
<field name="arch" type="xml">
<tree string="View name">
...
<field name="name" options='{"fg_color": "white:customer == True"}'/>
...
</tree>
</field>
...
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::
...
<field name="arch" type="xml">
<tree string="View name" colors="color_field: my_color" >
...
<field name="my_color" invisible="1"/>
...
</tree>
</field>
...
* You can also use ``colors="bg_color_field: my_color"`` to defined the field name that will be used
for the background color of the line.
* If you want to use more than one color, you can split the attributes using ';':
.. code::
options='{"fg_color": "red:red_color == True; green:green_color == True"}'
Example:
.. code:: xml
...
<field name="arch" type="xml">
<tree string="View name">
...
<field name="name" options='{"fg_color": "red:red_color == True; green:green_color == True"}'/>
...
</tree>
</field>
...
With this example, the content of the field named `my_color` will be used to
populate the `my_color` CSS value. Use a function field to return whichever
color you want depending on the other record values. Note that this
overrides the rest of `colors` attributes, and that you need the tree
to load your field in the first place by adding it as invisible field.
* Can use strings too... In the tree view declaration, put ``options="{'fg_color': 'green:customer_state == \'success\''}"`` attribute in the ``field`` tag::
...
<field name="arch" type="xml">
<tree string="View name">
...
<field name="name" options="{'fg_color': 'green:customer_state == \'success\''}"/>
...
</tree>
</field>
...
**Note that you can use single or normal quotes. If the declaration of the options doesn't follow the JSON format, the options string will be evaluated using py.eval()**

View File

@ -1,3 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head> <head>
@ -368,21 +369,32 @@ ul.auto-toc {
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! source digest: sha256:4d2a045e0badb54f2ac7bd7ae62c086e68960c402df8bbce1ba7fc76716b7452 !! source digest: sha256:4d2a045e0badb54f2ac7bd7ae62c086e68960c402df8bbce1ba7fc76716b7452
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! --> !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! -->
<p><a class="reference external image-reference" href="https://odoo-community.org/page/development-status"><img alt="Beta" src="https://img.shields.io/badge/maturity-Beta-yellow.png" /></a> <a class="reference external image-reference" href="http://www.gnu.org/licenses/agpl-3.0-standalone.html"><img alt="License: AGPL-3" src="https://img.shields.io/badge/licence-AGPL--3-blue.png" /></a> <a class="reference external image-reference" href="https://github.com/OCA/web/tree/15.0/web_tree_dynamic_colored_field"><img alt="OCA/web" src="https://img.shields.io/badge/github-OCA%2Fweb-lightgray.png?logo=github" /></a> <a class="reference external image-reference" href="https://translation.odoo-community.org/projects/web-15-0/web-15-0-web_tree_dynamic_colored_field"><img alt="Translate me on Weblate" src="https://img.shields.io/badge/weblate-Translate%20me-F47D42.png" /></a> <a class="reference external image-reference" href="https://runboat.odoo-community.org/builds?repo=OCA/web&amp;target_branch=15.0"><img alt="Try me on Runboat" src="https://img.shields.io/badge/runboat-Try%20me-875A7B.png" /></a></p> <p><a class="reference external image-reference" href="https://odoo-community.org/page/development-status"><img alt="Beta" src="https://img.shields.io/badge/maturity-Beta-yellow.png" /></a> <a class="reference external image-reference" href="http://www.gnu.org/licenses/agpl-3.0-standalone.html"><img alt="License: AGPL-3" src="https://img.shields.io/badge/licence-AGPL--3-blue.png" /></a> <a class="reference external image-reference" href="https://github.com/OCA/web/tree/17.0/web_tree_dynamic_colored_field"><img alt="OCA/web" src="https://img.shields.io/badge/github-OCA%2Fweb-lightgray.png?logo=github" /></a> <a class="reference external image-reference" href="https://translation.odoo-community.org/projects/web-17-0/web-17-0-web_tree_dynamic_colored_field"><img alt="Translate me on Weblate" src="https://img.shields.io/badge/weblate-Translate%20me-F47D42.png" /></a> <a class="reference external image-reference" href="https://runboat.odoo-community.org/builds?repo=OCA/web&amp;target_branch=17.0"><img alt="Try me on Runboat" src="https://img.shields.io/badge/runboat-Try%20me-875A7B.png" /></a></p>
<p>This module aims to add support for dynamically coloring fields in tree view <p>This module aims to add support for dynamically coloring fields in tree
according to data in the record.</p> view according to data in the record.</p>
<div class="section" id="features"> <div class="section" id="features">
<h1>Features</h1> <h1>Features</h1>
<ul class="simple"> <ul class="simple">
<li>Add attribute <tt class="docutils literal">bg_color</tt> on fields <tt class="docutils literal">options</tt> to color background of a cell in tree view</li> <li>Add attribute <tt class="docutils literal">bg_color</tt> on fields <tt class="docutils literal">options</tt> to color background
<li>Add attribute <tt class="docutils literal">fg_color</tt> on fields <tt class="docutils literal">options</tt> to change text color of a cell in tree view</li> of a cell in tree view</li>
<li>Add attribute <tt class="docutils literal">fg_color</tt> on fields <tt class="docutils literal">options</tt> to change text
color of a cell in tree view</li>
</ul> </ul>
<p><strong>Table of contents</strong></p> <p><strong>Table of contents</strong></p>
<div class="contents local topic" id="contents">
<ul class="simple">
<li><a class="reference internal" href="#usage" id="toc-entry-1">Usage</a></li>
<li><a class="reference internal" href="#known-issues-roadmap" id="toc-entry-2">Known issues / Roadmap</a></li>
<li><a class="reference internal" href="#bug-tracker" id="toc-entry-3">Bug Tracker</a></li>
<li><a class="reference internal" href="#credits" id="toc-entry-4">Credits</a></li>
</ul>
</div> </div>
<div class="section" id="usage"> <div class="section" id="usage">
<h1>Usage</h1> <h2><a class="toc-backref" href="#toc-entry-1">Usage</a></h2>
<ul> <ul>
<li><p class="first">In the tree view declaration, put <tt class="docutils literal"><span class="pre">options='{&quot;bg_color&quot;:</span> &quot;red: <span class="pre">customer==True&quot;}</span></tt> attribute in the <tt class="docutils literal">field</tt> tag:</p> <li><p class="first">In the tree view declaration, put
<tt class="docutils literal"><span class="pre">options='{&quot;bg_color&quot;:</span> &quot;red: <span class="pre">customer==True&quot;}</span></tt> attribute in the
<tt class="docutils literal">field</tt> tag:</p>
<pre class="literal-block"> <pre class="literal-block">
... ...
&lt;field name=&quot;arch&quot; type=&quot;xml&quot;&gt; &lt;field name=&quot;arch&quot; type=&quot;xml&quot;&gt;
@ -397,7 +409,9 @@ according to data in the record.</p>
With this example, column which renders 'name' field will have its background colored in red. With this example, column which renders 'name' field will have its background colored in red.
</pre> </pre>
</li> </li>
<li><p class="first">In the tree view declaration, put <tt class="docutils literal"><span class="pre">options='{&quot;fg_color&quot;:</span> &quot;white:customer == <span class="pre">True&quot;}'</span></tt> attribute in the <tt class="docutils literal">field</tt> tag:</p> <li><p class="first">In the tree view declaration, put
<tt class="docutils literal"><span class="pre">options='{&quot;fg_color&quot;:</span> &quot;white:customer == <span class="pre">True&quot;}'</span></tt> attribute in the
<tt class="docutils literal">field</tt> tag:</p>
<pre class="literal-block"> <pre class="literal-block">
... ...
&lt;field name=&quot;arch&quot; type=&quot;xml&quot;&gt; &lt;field name=&quot;arch&quot; type=&quot;xml&quot;&gt;
@ -412,7 +426,9 @@ With this example, column which renders 'name' field will have its background co
With this example, column which renders 'name' field will have its text colored in white on a customer records. With this example, column which renders 'name' field will have its text colored in white on a customer records.
</pre> </pre>
</li> </li>
<li><p class="first">In the tree view declaration, use <tt class="docutils literal"><span class="pre">options='&quot;color_field&quot;:</span> &quot;my_color&quot;'</tt> attribute in the <tt class="docutils literal">tree</tt> tag:</p> <li><p class="first">In the tree view declaration, use
<tt class="docutils literal"><span class="pre">options='&quot;color_field&quot;:</span> &quot;my_color&quot;'</tt> attribute in the <tt class="docutils literal">tree</tt>
tag:</p>
<pre class="literal-block"> <pre class="literal-block">
... ...
&lt;field name=&quot;arch&quot; type=&quot;xml&quot;&gt; &lt;field name=&quot;arch&quot; type=&quot;xml&quot;&gt;
@ -425,13 +441,14 @@ With this example, column which renders 'name' field will have its text colored
... ...
</pre> </pre>
</li> </li>
<li><p class="first">You can also use <tt class="docutils literal"><span class="pre">colors=&quot;bg_color_field:</span> my_color&quot;</tt> to defined the field name that will be used <li><p class="first">You can also use <tt class="docutils literal"><span class="pre">colors=&quot;bg_color_field:</span> my_color&quot;</tt> to defined the
for the background color of the line.</p> field name that will be used for the background color of the line.</p>
</li> </li>
<li><p class="first">If you want to use more than one color, you can split the attributes using ;:</p> <li><p class="first">If you want to use more than one color, you can split the attributes
using ;:</p>
</li> </li>
</ul> </ul>
<pre class="code literal-block"> <pre class="literal-block">
options='{&quot;fg_color&quot;: &quot;red:red_color == True; green:green_color == True&quot;}' options='{&quot;fg_color&quot;: &quot;red:red_color == True; green:green_color == True&quot;}'
</pre> </pre>
<p>Example:</p> <p>Example:</p>
@ -453,7 +470,9 @@ options='{&quot;fg_color&quot;: &quot;red:red_color == True; green:green_color =
</span>to<span class="w"> </span>load<span class="w"> </span>your<span class="w"> </span>field<span class="w"> </span>in<span class="w"> </span>the<span class="w"> </span>first<span class="w"> </span>place<span class="w"> </span>by<span class="w"> </span>adding<span class="w"> </span>it<span class="w"> </span>as<span class="w"> </span>invisible<span class="w"> </span>field. </span>to<span class="w"> </span>load<span class="w"> </span>your<span class="w"> </span>field<span class="w"> </span>in<span class="w"> </span>the<span class="w"> </span>first<span class="w"> </span>place<span class="w"> </span>by<span class="w"> </span>adding<span class="w"> </span>it<span class="w"> </span>as<span class="w"> </span>invisible<span class="w"> </span>field.
</pre> </pre>
<ul> <ul>
<li><p class="first">Can use strings too… In the tree view declaration, put <tt class="docutils literal"><span class="pre">options=&quot;{'fg_color':</span> 'green:customer_state == <span class="pre">\'success\''}&quot;</span></tt> attribute in the <tt class="docutils literal">field</tt> tag:</p> <li><p class="first">Can use strings too… In the tree view declaration, put
<tt class="docutils literal"><span class="pre">options=&quot;{'fg_color':</span> 'green:customer_state == <span class="pre">\'success\''}&quot;</span></tt>
attribute in the <tt class="docutils literal">field</tt> tag:</p>
<pre class="literal-block"> <pre class="literal-block">
... ...
&lt;field name=&quot;arch&quot; type=&quot;xml&quot;&gt; &lt;field name=&quot;arch&quot; type=&quot;xml&quot;&gt;
@ -467,37 +486,42 @@ options='{&quot;fg_color&quot;: &quot;red:red_color == True; green:green_color =
</pre> </pre>
</li> </li>
</ul> </ul>
<p><strong>Note that you can use single or normal quotes. If the declaration of the options doesnt follow the JSON format, the options string will be evaluated using py.eval()</strong></p> <p><strong>Note that you can use single or normal quotes. If the declaration of
the options doesnt follow the JSON format, the options string will be
evaluated using py.eval()</strong></p>
</div> </div>
<div class="section" id="known-issues-roadmap"> <div class="section" id="known-issues-roadmap">
<h1>Known issues / Roadmap</h1> <h2><a class="toc-backref" href="#toc-entry-2">Known issues / Roadmap</a></h2>
<ul class="simple"> <ul class="simple">
<li>Before version 13.0, this module had a feature allowing to change the color of <li>Before version 13.0, this module had a feature allowing to change the
a line depending on a field, using a <tt class="docutils literal">colors</tt> attribute with the name of the color of a line depending on a field, using a <tt class="docutils literal">colors</tt> attribute
field on the <tt class="docutils literal">&lt;tree&gt;</tt> element. Since 13.0, the <tt class="docutils literal">colors</tt> attribute is no with the name of the field on the <tt class="docutils literal">&lt;tree&gt;</tt> element. Since 13.0, the
longer in the RelaxNG schema of the tree view, so we cant use it anymore. <tt class="docutils literal">colors</tt> attribute is no longer in the RelaxNG schema of the tree
This feature has then been dropped, but could be reimplement in another way.</li> view, so we cant use it anymore. This feature has then been dropped,
but could be reimplement in another way.</li>
</ul> </ul>
</div> </div>
<div class="section" id="bug-tracker"> <div class="section" id="bug-tracker">
<h1>Bug Tracker</h1> <h2><a class="toc-backref" href="#toc-entry-3">Bug Tracker</a></h2>
<p>Bugs are tracked on <a class="reference external" href="https://github.com/OCA/web/issues">GitHub Issues</a>. <p>Bugs are tracked on <a class="reference external" href="https://github.com/OCA/web/issues">GitHub Issues</a>.
In case of trouble, please check there if your issue has already been reported. In case of trouble, please check there if your issue has already been reported.
If you spotted it first, help us to smash it by providing a detailed and welcomed If you spotted it first, help us to smash it by providing a detailed and welcomed
<a class="reference external" href="https://github.com/OCA/web/issues/new?body=module:%20web_tree_dynamic_colored_field%0Aversion:%2015.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**">feedback</a>.</p> <a class="reference external" href="https://github.com/OCA/web/issues/new?body=module:%20web_tree_dynamic_colored_field%0Aversion:%2017.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**">feedback</a>.</p>
<p>Do not contact contributors directly about support or help with technical issues.</p> <p>Do not contact contributors directly about support or help with technical issues.</p>
</div> </div>
<div class="section" id="credits"> <div class="section" id="credits">
<h1>Credits</h1> <h2><a class="toc-backref" href="#toc-entry-4">Credits</a></h2>
</div>
</div>
<div class="section" id="authors"> <div class="section" id="authors">
<h2>Authors</h2> <h1>Authors</h1>
<ul class="simple"> <ul class="simple">
<li>Camptocamp</li> <li>Camptocamp</li>
<li>Therp BV</li> <li>Therp BV</li>
</ul> </ul>
</div> </div>
<div class="section" id="contributors"> <div class="section" id="contributors">
<h2>Contributors</h2> <h1>Contributors</h1>
<ul class="simple"> <ul class="simple">
<li>Damien Crier &lt;<a class="reference external" href="mailto:damien.crier&#64;camptocamp.com">damien.crier&#64;camptocamp.com</a>&gt;</li> <li>Damien Crier &lt;<a class="reference external" href="mailto:damien.crier&#64;camptocamp.com">damien.crier&#64;camptocamp.com</a>&gt;</li>
<li>Holger Brunn &lt;<a class="reference external" href="mailto:hbrunn&#64;therp.nl">hbrunn&#64;therp.nl</a>&gt;</li> <li>Holger Brunn &lt;<a class="reference external" href="mailto:hbrunn&#64;therp.nl">hbrunn&#64;therp.nl</a>&gt;</li>
@ -508,23 +532,22 @@ If you spotted it first, help us to smash it by providing a detailed and welcome
</ul> </ul>
</div> </div>
<div class="section" id="other-credits"> <div class="section" id="other-credits">
<h2>Other credits</h2> <h1>Other credits</h1>
<p>The development of this module has been financially supported by:</p> <p>The development of this module has been financially supported by:</p>
<ul class="simple"> <ul class="simple">
<li>Camptocamp</li> <li>Camptocamp</li>
</ul> </ul>
</div> </div>
<div class="section" id="maintainers"> <div class="section" id="maintainers">
<h2>Maintainers</h2> <h1>Maintainers</h1>
<p>This module is maintained by the OCA.</p> <p>This module is maintained by the OCA.</p>
<a class="reference external image-reference" href="https://odoo-community.org"><img alt="Odoo Community Association" src="https://odoo-community.org/logo.png" /></a> <a class="reference external image-reference" href="https://odoo-community.org"><img alt="Odoo Community Association" src="https://odoo-community.org/logo.png" /></a>
<p>OCA, or the Odoo Community Association, is a nonprofit organization whose <p>OCA, or the Odoo Community Association, is a nonprofit organization whose
mission is to support the collaborative development of Odoo features and mission is to support the collaborative development of Odoo features and
promote its widespread use.</p> promote its widespread use.</p>
<p>This module is part of the <a class="reference external" href="https://github.com/OCA/web/tree/15.0/web_tree_dynamic_colored_field">OCA/web</a> project on GitHub.</p> <p>This module is part of the <a class="reference external" href="https://github.com/OCA/web/tree/17.0/web_tree_dynamic_colored_field">OCA/web</a> project on GitHub.</p>
<p>You are welcome to contribute. To learn how please visit <a class="reference external" href="https://odoo-community.org/page/Contribute">https://odoo-community.org/page/Contribute</a>.</p> <p>You are welcome to contribute. To learn how please visit <a class="reference external" href="https://odoo-community.org/page/Contribute">https://odoo-community.org/page/Contribute</a>.</p>
</div> </div>
</div> </div>
</div>
</body> </body>
</html> </html>