允许您根据记录中的数据动态着色树视图中的字段
项目描述
本模块旨在为树视图中根据记录中的数据动态着色字段提供支持。
它为字段提供了类似于树标签中“colors”属性的语法属性。
此外,它还为树标签的“colors”提供了“color_field”属性,用于使用字段值作为颜色。
功能
在字段“options”上添加属性“bg_color”,以在树视图中着色单元格的背景
在字段“options”上添加属性“fg_color”,以更改树视图中单元格的文本颜色
在树元素的“colors”上添加属性“color_field”,用作文本颜色
在树元素的“colors”上添加属性“bg_color_field”,用作背景颜色
目录表
用法
在树视图声明中,将options='{"bg_color": "red: customer==True"}属性放入field标签中
... <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.
在树视图声明中,将options='{"fg_color": "white:customer == True"}'属性放入field标签中
... <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.
在树形视图声明中,请在 tree 标签中使用 options='"color_field": "my_color"' 属性。
... <field name="arch" type="xml"> <tree string="View name" colors="color_field: my_color; bg_color_field: my_background_color" > ... <field name="my_color" invisible="1"/> <field name="my_background_color" invisible="1"/> ... </tree> </field> ...
您还可以使用 colors="bg_color_field: my_color" 来定义将用于行背景色的字段名称。
如果您想使用多个颜色,可以使用分号‘;’分隔属性。
options='{"fg_color": "red:red_color == True; green:green_color == True"}'
示例
...
<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.
请注意,您应始终为字段‘options’使用单引号,并将嵌套值用双引号括起来,因为‘options’是一个JSON对象。
错误跟踪器
错误在 GitHub Issues 上跟踪。如果遇到问题,请检查是否已报告您的问题。如果您是第一个发现它的人,请提供详细且受欢迎的 反馈,以帮助我们解决问题。
请不要直接联系贡献者以获取支持或帮助解决技术问题。
致谢
贡献者
Damien Crier <damien.crier@camptocamp.com>
Holger Brunn <hbrunn@therp.nl>
Artem Kostyuk <a.kostyuk@mobilunity.com>
Guewen Baconnier <guewen.baconnier@camptocamp.com>
Sylvain LE GAL <https://twitter.com/legalsylvain>
维护者
此模块由OCA维护。
OCA,或Odoo社区协会,是一个非营利组织,其使命是支持Odoo功能的协作开发并促进其广泛使用。
此模块是GitHub上的OCA/web项目的组成部分。
欢迎您贡献。要了解如何贡献,请访问https://odoo-community.org/page/Contribute。
项目详情
哈希值 for odoo12_addon_web_tree_dynamic_colored_field-12.0.1.1.2-py3-none-any.whl
算法 | 哈希摘要 | |
---|---|---|
SHA256 | 53d0ca4d9525bb0046db4d0505bcde8c1aa89fd9a8963c699387975d4ec262a5 |
|
MD5 | ac51c6c6c4a629587d84a8827b1d5774 |
|
BLAKE2b-256 | 2ad513ceb9670a5a7cf2e53f8d68a074b1908380bd596dc8fcfe38666c8c8b11 |