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

I want to to apply a logic on the list view 

There is a field x_doe (expiry date) for, If the Current date (system date) is 1 week due the date of expiry, the color of the view should become red...

can you please tell me how to apply that?

อวตาร
ละทิ้ง
คำตอบที่ดีที่สุด

Hi Suhaib,

You can simply define a computed field and then utilize that in decoration danger in list view.



อวตาร
ละทิ้ง
คำตอบที่ดีที่สุด

Hi,

As far as I know you won't be able to change the color of the date field itself in odoo 11, but you can make the record/line red in the listview by adding the following to the tree view tag in the list view 

decoration-danger="x_doe >= (context_today() + relativedelta(days=-7)).strftime('%Y-%m-%d')"

Example below is what I tested on Odoo demo site for sales orders.

<tree string="Quotation" class="o_sale_order" multi_edit="1" sample="1" decoration-danger="create_date >= (context_today() + relativedelta(days=-7)).strftime('%Y-%m-%d')" >

Kind Regards,

อวตาร
ละทิ้ง
คำตอบที่ดีที่สุด

you can take reference from the manufacturing orders tree view

อวตาร
ละทิ้ง
Related Posts ตอบกลับ มุมมอง กิจกรรม
2
พ.ค. 21
19087
1
มิ.ย. 18
9075
0
ธ.ค. 23
1391
1
พ.ค. 23
2898
1
ก.ย. 22
8294