Bỏ qua để đến Nội dung
Menu
Câu hỏi này đã bị gắn cờ
1 Trả lời
11773 Lượt xem

Hi Guys,

I'm using OpenERP 7 & want to add background color to specific rows in a tree view, based on certain value of a field.

Ex: Suppose say I have name, phone, status fields in my model. Then I want to color code my rows in a tree view, based on the value of status field. If status is Single, the row will be RED, If status is Married, the row will be Green etc..

Please help me on this. Any help would be appreciated :)

Cheers

ASP:)

Ảnh đại diện
Huỷ bỏ

*Hi, add this in your xml file...* <tree string="Sample" colors="red:state=='single';green:state=='married' "> <field name="title" string="Name"/> </tree>

Câu trả lời hay nhất

Hi, use the below code...

In py file

'status' : fields.selection([('single','Single'),('married','Married')],'Status?'),

In xml file

<tree string="Status" colors="red:shop=='single';green:shop=='married' ">
    <field name="name"></field>
    <field name="status"></field>
</tree>
Ảnh đại diện
Huỷ bỏ
Bài viết liên quan Trả lời Lượt xem Hoạt động
0
thg 3 15
3821
2
thg 10 24
12387
3
thg 10 17
16841
0
thg 3 15
6995
1
thg 3 15
6136