允许您根据记录中的数据动态着色树形视图中的字段
项目描述
此模块旨在根据记录中的数据在树形视图中动态着色字段,以支持对字段的着色。
功能
在字段的 options 上添加属性 bg_color 以着色树形视图中单元格的背景
在字段的 options 上添加属性 fg_color 以更改树形视图中单元格的文本颜色
目录表
用法
在树形视图声明中,在 field 标签中放置 options='{"bg_color": "red: customer==True"} 属性
... <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.
在树形视图声明中,在 field 标签中放置 options='{"fg_color": "white:customer == True"}' 属性
... <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.
如果您想使用多种颜色,可以使用分号“;”分隔属性
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对象。
已知问题/路线图
在版本13.0之前,此模块具有一个功能,允许根据字段更改行的颜色,使用在 <tree> 元素上的名称为 colors 的属性。从13.0开始,colors 属性不再包含在树形视图的 RelaxNG 架构中,因此我们不能再使用它了。此功能已被删除,但可以以其他方式重新实现。
错误跟踪器
错误在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>
维护者
本模块由OCA维护。
OCA,即Odoo社区协会,是一个非营利组织,其使命是支持Odoo功能的协作开发并推广其广泛使用。
本模块是GitHub上的OCA/web项目的一部分。
欢迎您贡献。要了解如何贡献,请访问https://odoo-community.org/page/Contribute。
项目详情
哈希值 for odoo13_addon_web_tree_dynamic_colored_field-13.0.1.0.1.dev10-py3-none-any.whl
算法 | 哈希摘要 | |
---|---|---|
SHA256 | 04978c38650bede679a44ddec560b6d99efa09f0b9f8ce85e366985834d15060 |
|
MD5 | e897a8972cd84399464a45ce8f2d9320 |
|
BLAKE2b-256 | 1662725cb8ddd891dab1a8bdc8f60a2c0fdce3c1f147af3a9809c293b52c2853 |