允许您动态为树视图上的字段上色

odoo12-addon-web-tree-dynamic-colored-field的Python项目详细描述


BetaLicense: AGPL-3OCA/webTranslate me on WeblateTry me on Runbot

此模块旨在添加对树视图中字段动态着色的支持 根据记录中的数据。

它为字段提供与colors属性语法相似的属性 在树标记中。

此外,它在树标记的colors上提供了一个color_field属性来使用 字段的颜色值。

功能

  • 将字段的options上的属性bg_color添加到树视图中单元格的颜色背景中
  • 在字段的options上添加属性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.
    
  • 在树视图声明中,使用tree标记中的options='"color_field": "my_color"'属性:

    ...
    <field name="arch" type="xml">
        <tree string="View name" colors="color_field: my_color" >
            ...
            <field name="my_color" invisible="1"/>
            ...
        </tree>
    </field>
    ...
    
  • 如果要使用多个颜色,可以使用“;”分割属性:

options='{"fg_color": "red:red_color == True; green:green_color == True"}'

示例:

...
 <fieldname="arch"type="xml"><treestring="View name">
         ...
         <fieldname="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上跟踪。 如果出现问题,请检查是否已报告您的问题。 如果你先发现了它,请提供详细的 feedback

不要就技术问题直接与贡献者联系。

学分

作者

  • 露营车
  • Therp公司

贡献者

维护人员

此模块由OCA维护。

Odoo Community Association

oca,或odoo社区协会,是一个非营利性组织 任务是支持odoo特性和 促进其广泛应用。

此模块是github上OCA/web项目的一部分。

欢迎您的贡献。要了解如何访问https://odoo-community.org/page/Contribute

欢迎加入QQ群-->: 979659372 Python中文网_新手群

推荐PyPI第三方库


热门话题
基于Java的遗传算法确定最优交易行为   java改型2.0无法解析Json嵌套对象   java在数组中查找最大额定值(数字),我们不能跳过数组中的一个或多个连续数字   java在spring boot中从命令行设置活动概要文件和配置位置   JavaAxis2:传输错误:404错误:未找到帮助理解其真正含义   java使用Play2WAR和Play2.2.1   java理解函数运算符:Lambda   在代理java后面读取https网页数据   java应用程序。Android单元测试中的类mock   java为什么onClick布局XML引用的方法需要是公共的?   从SMTLIB2文件解析的java显示声明   java重写给定的类以使用组合而不是继承   HTMLUnit和Java:NoSuchMethodException:createDefaultSSLContext()   java如何使用Spring和ThymeLeaf从前端正确更新后端中的对象?   来自init()Java的方法调用   使用cellrendering从数据库向JTable动态添加数据后,java无法使用JTable执行排序操作   java Android Studio 1.5.1。渲染错误(浮动操作按钮)   web服务如何使用UsenameToken和PasswordDigest为JAVA中的SOAP客户端附加wsse安全头   java为什么要在局部变量和myApplicationClass中同时删除“ArrayList.remove”?