attrs="{'invisible': ['|', ('probability', '>', 0), ('active', '=', True)]}"/>。   写法gt 大于

attrs="{'invisible': [('active', '=', False),('probability', '<', 100)]}"/>。 写法lt   小于

<field name="tag_ids" widget="many2many_tags" options="{'color_field': 'color', 'no_create_edit': True}"/>






colors="颜色名:字段名==字段值"

 例如:


colors="blue:state=='enable';black:state=='disable';gray:state=='discard';"

 


二:根据字段值,改变行为(只读、可见性)


attrs="{'readonly':[('字段','=',值)]}
attrs="{'invisible': [('字段','=',值)]}"

 


三:Tree视图记录动态样式


    tree视图可以根据每行纪录的某字段值不同而把每行以不同样式显示


decoration-{样式}="条件"

    样式主要有:


    bf(font-weight:bold):字体加粗


    it(font-style:italic):斜体字


    danger:红色字体


    info:蓝色字体


    muted:灰色字体


    primary:紫色字体


    success:绿色字体
    warning:棕色字体


odoo里面条件写法

 <field name="arch" type="xml">
       <tree string="" decoration-样式="条件表达式">
           <field name="用于判断的字段" invisible="1"/>
           <field name="其他字段"/>
       </tree>
 </field>
 

相关文章:

  • 2022-12-23
  • 2022-12-23
  • 2021-04-19
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-11-23
猜你喜欢
  • 2022-12-23
  • 2021-06-25
  • 2022-12-23
  • 2021-07-04
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
相关资源
相似解决方案