Skip to Content
เมนู
คุณต้องลงทะเบียนเพื่อโต้ตอบกับคอมมูนิตี้
คำถามนี้ถูกตั้งค่าสถานะ
1 ตอบกลับ
12230 มุมมอง

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:)

อวตาร
ละทิ้ง

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

คำตอบที่ดีที่สุด

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>
อวตาร
ละทิ้ง
Related Posts ตอบกลับ มุมมอง กิจกรรม
0
มี.ค. 15
4174
How to color a field in tree view? แก้ไขแล้ว
2
ต.ค. 24
12727
3
ต.ค. 17
17187
0
มี.ค. 15
7325
1
มี.ค. 15
6425