【发布时间】:2019-09-25 12:14:32
【问题描述】:
如果选择字段中的值为“打开”、“待处理”和“已解决”,我想根据我的字段值应用格式设置,颜色应分别为“红色”、“蓝色”和“灰色”。
<field name = 'status' widget="selection" attrs="{'invisible':[('type','=','open')]}" style="color:red;" />
【问题讨论】:
标签: xml formatting odoo
如果选择字段中的值为“打开”、“待处理”和“已解决”,我想根据我的字段值应用格式设置,颜色应分别为“红色”、“蓝色”和“灰色”。
<field name = 'status' widget="selection" attrs="{'invisible':[('type','=','open')]}" style="color:red;" />
【问题讨论】:
标签: xml formatting odoo
<field name = 'status' widget="selection" decoration-danger="status=='open'" decoration-info="status=='pending'" decoration-muted="status=='solved'"/>
它对我有用。
【讨论】:
您可以使用t-att-style 属性代替style
例如:
t-att-style="'color: #f00;' if type == 'open' else ('color: #00f;' if type ==
'pending' else 'color: #696969;')"
试试这个(可能会有一些变化)
【讨论】: