You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

102 lines
2.9 KiB

  1. Colorize field in tree views
  2. ============================
  3. This module aims to add support for dynamically coloring fields in tree view
  4. according to data in the record.
  5. It provides attributes on fields with the same syntax as the 'colors' attribute
  6. in tree tags.
  7. Further, it provides a ``color_field`` attribute on tree tags to use a field's
  8. value as color.
  9. Features
  10. ========
  11. * Add attribute ``bg_color`` on fields to color background of a cell in tree view
  12. * Add attribute ``fg_color`` on fields to change text color of a cell in tree view
  13. * Add attribute ``color_field`` on the tree element to use as color
  14. Usage
  15. =====
  16. * In the tree view declaration, put bg_color="red:customer==True;" attribute in the field tag::
  17. ...
  18. <field name="arch" type="xml">
  19. <tree string="View name">
  20. ...
  21. <field name="name" bg_color="red:customer==True;"/>
  22. ...
  23. </tree>
  24. </field>
  25. ...
  26. With this example, column which renders 'name' field will have its background colored in red.
  27. * In the tree view declaration, put fg_color="white:customer==True;" attribute in the field tag::
  28. ...
  29. <field name="arch" type="xml">
  30. <tree string="View name">
  31. ...
  32. <field name="name" fg_color="white:customer==True;"/>
  33. ...
  34. </tree>
  35. </field>
  36. ...
  37. With this example, column which renders 'name' field will have its text colored in white.
  38. * In the tree view declaration, use color_field="color" attribute in the tree tag::
  39. ...
  40. <field name="arch" type="xml">
  41. <tree string="View name" color_field="color">
  42. ...
  43. <field name="color" invisible="1" />
  44. ...
  45. </tree>
  46. </field>
  47. ...
  48. With this example, the content of the field named `color` will be used to
  49. populate the `color` CSS value. Use a function field to return whichever
  50. color you want depending on the other record values. Note that this
  51. overrides the `colors` attribute, and that you need the tree to load your
  52. field in the first place by adding it as invisible field.
  53. Bug Tracker
  54. ===========
  55. Bugs are tracked on `GitHub Issues
  56. <https://github.com/OCA/web/issues>`_. In case of trouble, please
  57. check there if your issue has already been reported. If you spotted it first,
  58. help us smashing it by providing a detailed and welcomed feedback.
  59. Credits
  60. =======
  61. Contributors
  62. ------------
  63. * Damien Crier <damien.crier@camptocamp.com>
  64. * Holger Brunn <hbrunn@therp.nl>
  65. Maintainer
  66. ----------
  67. .. image:: https://odoo-community.org/logo.png
  68. :alt: Odoo Community Association
  69. :target: https://odoo-community.org
  70. This module is maintained by the OCA.
  71. OCA, or the Odoo Community Association, is a nonprofit organization whose
  72. mission is to support the collaborative development of Odoo features and
  73. promote its widespread use.
  74. To contribute to this module, please visit https://odoo-community.org.