diff --git a/web_tree_dynamic_colored_field/README.rst b/web_tree_dynamic_colored_field/README.rst index 9706f26a1..b8b14d5a4 100644 --- a/web_tree_dynamic_colored_field/README.rst +++ b/web_tree_dynamic_colored_field/README.rst @@ -17,25 +17,27 @@ Colorize field in tree views :target: http://www.gnu.org/licenses/agpl-3.0-standalone.html :alt: License: AGPL-3 .. |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 .. |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 .. |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 |badge1| |badge2| |badge3| |badge4| |badge5| -This module aims to add support for dynamically coloring fields in tree view -according to data in the record. +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 +- 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 **Table of contents** @@ -45,52 +47,65 @@ Features 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: - ... - - - ... - - ... - - - ... + :: - 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:: + 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: - 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:: + ... + + + ... + + ... + + + ... - ... - - - ... - - ... - - - ... + With this example, column which renders 'name' field will have its text colored in white on a customer records. -* 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. +- In the tree view declaration, use + ``options='"color_field": "my_color"'`` attribute in the ``tree`` + tag: -* If you want to use more than one color, you can split the attributes using ';': + :: -.. code:: + ... + + + ... + + ... + + + ... + +- 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"}' @@ -114,28 +129,35 @@ Example: 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:: +- Can use strings too... In the tree view declaration, put + ``options="{'fg_color': 'green:customer_state == \'success\''}"`` + attribute in the ``field`` tag: - ... - - - ... - - ... - - - ... + :: -**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 ====================== -* 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 ```` 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. +- 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 ```` 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. Bug Tracker =========== @@ -143,7 +165,7 @@ Bug Tracker Bugs are tracked on `GitHub Issues `_. 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 -`feedback `_. +`feedback `_. Do not contact contributors directly about support or help with technical issues. @@ -151,30 +173,30 @@ Credits ======= Authors -~~~~~~~ +------- * Camptocamp * Therp BV Contributors -~~~~~~~~~~~~ +------------ -* Damien Crier -* Holger Brunn -* Artem Kostyuk -* Guewen Baconnier -* Phuc Tran Thanh -* Sylvain LE GAL +- Damien Crier +- Holger Brunn +- Artem Kostyuk +- Guewen Baconnier +- Phuc Tran Thanh +- Sylvain LE GAL Other credits -~~~~~~~~~~~~~ +------------- The development of this module has been financially supported by: -* Camptocamp +- Camptocamp Maintainers -~~~~~~~~~~~ +----------- 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 promote its widespread use. -This module is part of the `OCA/web `_ project on GitHub. +This module is part of the `OCA/web `_ project on GitHub. You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute. diff --git a/web_tree_dynamic_colored_field/pyproject.toml b/web_tree_dynamic_colored_field/pyproject.toml new file mode 100644 index 000000000..4231d0ccc --- /dev/null +++ b/web_tree_dynamic_colored_field/pyproject.toml @@ -0,0 +1,3 @@ +[build-system] +requires = ["whool"] +build-backend = "whool.buildapi" diff --git a/web_tree_dynamic_colored_field/readme/CONTRIBUTORS.md b/web_tree_dynamic_colored_field/readme/CONTRIBUTORS.md new file mode 100644 index 000000000..9a3eff112 --- /dev/null +++ b/web_tree_dynamic_colored_field/readme/CONTRIBUTORS.md @@ -0,0 +1,6 @@ +- Damien Crier \<\> +- Holger Brunn \<\> +- Artem Kostyuk \<\> +- Guewen Baconnier \<\> +- Phuc Tran Thanh \<\> +- Sylvain LE GAL \<\> diff --git a/web_tree_dynamic_colored_field/readme/CONTRIBUTORS.rst b/web_tree_dynamic_colored_field/readme/CONTRIBUTORS.rst deleted file mode 100644 index 12bffa38d..000000000 --- a/web_tree_dynamic_colored_field/readme/CONTRIBUTORS.rst +++ /dev/null @@ -1,6 +0,0 @@ -* Damien Crier -* Holger Brunn -* Artem Kostyuk -* Guewen Baconnier -* Phuc Tran Thanh -* Sylvain LE GAL diff --git a/web_tree_dynamic_colored_field/readme/CREDITS.rst b/web_tree_dynamic_colored_field/readme/CREDITS.md similarity index 83% rename from web_tree_dynamic_colored_field/readme/CREDITS.rst rename to web_tree_dynamic_colored_field/readme/CREDITS.md index f5cc070c7..705d3b30c 100644 --- a/web_tree_dynamic_colored_field/readme/CREDITS.rst +++ b/web_tree_dynamic_colored_field/readme/CREDITS.md @@ -1,3 +1,3 @@ The development of this module has been financially supported by: -* Camptocamp +- Camptocamp diff --git a/web_tree_dynamic_colored_field/readme/DESCRIPTION.md b/web_tree_dynamic_colored_field/readme/DESCRIPTION.md new file mode 100644 index 000000000..f1c8a74a1 --- /dev/null +++ b/web_tree_dynamic_colored_field/readme/DESCRIPTION.md @@ -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 diff --git a/web_tree_dynamic_colored_field/readme/DESCRIPTION.rst b/web_tree_dynamic_colored_field/readme/DESCRIPTION.rst deleted file mode 100644 index 1568429d5..000000000 --- a/web_tree_dynamic_colored_field/readme/DESCRIPTION.rst +++ /dev/null @@ -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 diff --git a/web_tree_dynamic_colored_field/readme/ROADMAP.md b/web_tree_dynamic_colored_field/readme/ROADMAP.md new file mode 100644 index 000000000..d66580c7e --- /dev/null +++ b/web_tree_dynamic_colored_field/readme/ROADMAP.md @@ -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 `` 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. diff --git a/web_tree_dynamic_colored_field/readme/ROADMAP.rst b/web_tree_dynamic_colored_field/readme/ROADMAP.rst deleted file mode 100644 index 4d068a177..000000000 --- a/web_tree_dynamic_colored_field/readme/ROADMAP.rst +++ /dev/null @@ -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 ```` 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. diff --git a/web_tree_dynamic_colored_field/readme/USAGE.md b/web_tree_dynamic_colored_field/readme/USAGE.md new file mode 100644 index 000000000..d50d9b735 --- /dev/null +++ b/web_tree_dynamic_colored_field/readme/USAGE.md @@ -0,0 +1,92 @@ +- In the tree view declaration, put + `options='{"bg_color": "red: customer==True"}` attribute in the + `field` tag: + + ... + + + ... + + ... + + + ... + + 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: + + ... + + + ... + + ... + + + ... + + 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: + + ... + + + ... + + ... + + + ... + +- 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 +... + + + ... + + ... + + + ... + + 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: + + ... + + + ... + + ... + + + ... + +**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()** diff --git a/web_tree_dynamic_colored_field/readme/USAGE.rst b/web_tree_dynamic_colored_field/readme/USAGE.rst deleted file mode 100644 index 92754f145..000000000 --- a/web_tree_dynamic_colored_field/readme/USAGE.rst +++ /dev/null @@ -1,82 +0,0 @@ -* In the tree view declaration, put ``options='{"bg_color": "red: customer==True"}`` attribute in the ``field`` tag:: - - ... - - - ... - - ... - - - ... - - 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:: - - ... - - - ... - - ... - - - ... - - 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:: - - ... - - - ... - - ... - - - ... - -* 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 - - ... - - - ... - - ... - - - ... - - 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:: - - ... - - - ... - - ... - - - ... - -**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()** diff --git a/web_tree_dynamic_colored_field/static/description/index.html b/web_tree_dynamic_colored_field/static/description/index.html index b31fc795f..c0a0ff8ed 100644 --- a/web_tree_dynamic_colored_field/static/description/index.html +++ b/web_tree_dynamic_colored_field/static/description/index.html @@ -1,3 +1,4 @@ + @@ -368,21 +369,32 @@ ul.auto-toc { !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! !! source digest: sha256:4d2a045e0badb54f2ac7bd7ae62c086e68960c402df8bbce1ba7fc76716b7452 !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! --> -

Beta License: AGPL-3 OCA/web Translate me on Weblate Try me on Runboat

-

This module aims to add support for dynamically coloring fields in tree view -according to data in the record.

+

Beta License: AGPL-3 OCA/web Translate me on Weblate Try me on Runboat

+

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
  • +
  • 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

Table of contents

+
-

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">
    @@ -397,7 +409,9 @@ according to data in the record.

    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">
    @@ -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.
     
  • -
  • 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">
    @@ -425,13 +441,14 @@ With this example, column which renders 'name' field will have its text colored
     ...
     
  • -
  • 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.

    +
  • 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 ‘;’:

    +
  • 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:

@@ -453,7 +470,9 @@ options='{"fg_color": "red:red_color == True; green:green_color = 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">
    @@ -467,37 +486,42 @@ options='{"fg_color": "red:red_color == True; green:green_color =
     
-

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 -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.
  • +
  • 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.
-

Bug Tracker

+

Bug Tracker

Bugs are tracked on GitHub Issues. 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 -feedback.

+feedback.

Do not contact contributors directly about support or help with technical issues.

-

Credits

+

Credits

+
+
-

Authors

+

Authors

  • Camptocamp
  • Therp BV
-

Contributors

+

Contributors

-

Other credits

+

Other credits

The development of this module has been financially supported by:

  • Camptocamp
-

Maintainers

+

Maintainers

This module is maintained by the OCA.

Odoo Community Association

OCA, or the Odoo Community Association, is a nonprofit organization whose mission is to support the collaborative development of Odoo features and promote its widespread use.

-

This module is part of the OCA/web project on GitHub.

+

This module is part of the OCA/web project on GitHub.

You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.

-