在openerp的tree视图中设置字体及颜色

Colors

Use the colors attribute on the tree element to colorize records based on some conditions. 

Example, to colorize session list depending on it’s state:

 

                

                                colors=”blue:state==’draft'; green:state==’confirmed’ “>

                     

                     

                     

                     

                     

                     

                     

                     

                     

                     

                 

 

Don’t forget to include the conditional field also in the field list, otherwise it will not work.

Some conditional expresions that can be used on the colors attribute:

If state in either ‘confirmed’, ‘done’, ‘waiting’ :

  • colors=”blue: state in (‘confirmed’, ‘done’, ‘waiting’)”

if state is equal to ‘draft’:

  • colors=”blue: state==’draft’ “

if duration is greater than 5:          

  • colors=”blue: duration > 5 “

if duration is less than 15:  

  • colors=”blue: duration < 15 “

multiple conditions:

  • colors=”blue: state in (‘confirmed’, ‘done’, ‘waiting’) ; red: state==’draft’”

 

Fonts

There is also fonts attribute to set the font of the records, for example to set bold fonts on records with message_unread is True:

  • fonts=”bold:message_unread==True”
来自:http://vitraining.com/colorize-and-fonts-in-tree-view-record-in-openerp/

另外使用视图的继承方法可以修改视图的color

The color can be changed with this code


in a inherith view you can change the color using attributes


    red:state='draft'


使用and


你可能感兴趣的:(OpenErp)