允许您根据记录中的数据动态着色树视图中的字段
项目描述
此模块旨在根据记录中的数据在树视图中动态着色字段。
功能
在字段的
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 之前,此模块具有一个功能,允许根据字段更改线条颜色,使用 colors 属性,并在 <tree> 元素上指定字段名称。从 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>
Phuc Tran Thanh <phuc@trobz.com>
其他致谢
本模块的开发得到了以下机构的财务支持
Camptocamp
维护者
本模块由 OCA 维护。
OCA,或 Odoo 社区协会,是一个非营利组织,其使命是支持 Odoo 功能的协作开发并推广其广泛使用。
本模块是 GitHub 上 OCA/web 项目的一部分。
欢迎您贡献力量。有关如何贡献的更多信息,请访问 https://odoo-community.org/page/Contribute。
项目详情
哈希值 for odoo14_addon_web_tree_dynamic_colored_field-14.0.1.0.1.dev4-py3-none-any.whl
算法 | 哈希摘要 | |
---|---|---|
SHA256 | 356660435f8f3beda34add95ec606904c626bd8563192ac1bdae8477b983861e |
|
MD5 | 34b90c6484d23af17be7123e01d95127 |
|
BLAKE2b-256 | aabb3211b5d3ecd9b370e5015ddaf6a6a5b95d121e6de080e7f3fde88d6f10a7 |