允许您动态为树视图上的字段上色
odoo10-addon-web-tree-dynamic-colored-field的Python项目详细描述
在树视图中为字段着色
此模块旨在添加对树视图中字段动态着色的支持 根据记录中的数据。
它在字段上提供与“colors”属性语法相同的属性 在树标记中。
此外,它在树标记上提供了一个color_field属性来使用字段的 值为颜色。
功能
- 将字段上的属性bg_color添加到树状视图中单元格的颜色背景
- 在字段上添加属性fg_color,以更改树视图中单元格的文本颜色
- 在树元素上添加属性color_field以用作颜色
用法
在树状图声明中,将bg_color=“red:customer==true;”属性放入字段标记:
... <field name="arch" type="xml"> <tree string="View name"> ... <field name="name" bg_color="red:customer==True;"/> ... </tree> </field> ... With this example, column which renders 'name' field will have its background colored in red.
在树状图声明中,将fg_color=“white:customer==true;”属性放入字段标记:
... <field name="arch" type="xml"> <tree string="View name"> ... <field name="name" fg_color="white:customer==True;"/> ... </tree> </field> ... With this example, column which renders 'name' field will have its text colored in white.
在树视图声明中,使用树标记中的color_field=“color”属性:
... <field name="arch" type="xml"> <tree string="View name" color_field="color"> ... <field name="color" invisible="1" /> ... </tree> </field> ... With this example, the content of the field named `color` will be used to populate the `color` CSS value. Use a function field to return whichever color you want depending on the other record values. Note that this overrides the `colors` attribute, and that you need the tree to load your field in the first place by adding it as invisible field.
错误跟踪程序
在GitHub Issues上跟踪错误。如果有麻烦,请 如果您的问题已经报告,请检查那里。如果你先发现它, 通过提供详细而受欢迎的反馈,帮助我们粉碎它。
学分
贡献者
- 达米恩·克里尔damien.crier@camptocamp.com>;
- 霍尔格·布鲁恩hbrunn@therp.nl>;
维修人员
此模块由OCA维护。
oca,或odoo社区协会,是一个非营利性组织 任务是支持odoo特性和 促进其广泛应用。
若要对此模块作出贡献,请访问https://odoo-community.org。