允许您根据记录中的数据动态着色树视图中的字段
项目描述
在树视图中着色字段
本模块旨在根据记录中的数据在树视图中动态着色字段的支持。
它提供了与树标签中colors属性类似语法的字段属性。
此外,它提供了在树标签的colors上使用color_field属性,以使用字段值作为颜色。
功能
在字段选项中添加bg_color属性以着色树视图中单元格的背景颜色
在字段选项中添加fg_color属性以更改树视图中单元格的文本颜色
在树元素的colors上添加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.
在树视图声明中,使用options='"color_field": "my_color"'属性在tree标签中使用
... <field name="arch" type="xml"> <tree string="View name" colors="color_field: my_color" > ... <field name="my_color" invisible="1"/> ... </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@camptocamp.com>
霍格·布伦 <hbrunn@therp.nl>
阿尔泰姆·科斯特尤克 <a.kostyuk@mobilunity.com>
格温·邦尼亚尔 <guewen.baconnier@camptocamp.com>
维护者
本模块由OCA维护。
OCA,即Odoo社区协会,是一个非营利组织,其使命是支持Odoo特性的协作开发并促进其广泛使用。
要为此模块做出贡献,请访问https://odoo-community.org。
项目详情
odoo11_addon_web_tree_dynamic_colored_field-11.0.1.0.1-py2.py3-none-any.whl的哈希
算法 | 哈希摘要 | |
---|---|---|
SHA256 | 9b87597a5165b2145dc88119debf197341de34204d5214f044c68eb0355311fe |
|
MD5 | 0f448e112a1e9e9a938cb68f34a0684c |
|
BLAKE2b-256 | c12e9385924beab0a9a28ffff6e65e7529c91c8c92c62b2d03ea1674e91f1122 |