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

Hi.


I have a stage called Completed (in projects) and a field called x_studio_findings. Im trying to se the background color of the card to red if the card is at Completed stage and the x_studio_findings field is not set.

Any ideas from the gurus?


my attempt: 



([['stage_id','=','Completed'],['x_studio_findings_1','=',False]]) and 'background-color: #cbf3c9;' or 'background-color: #ffffff;'

unfortunately i cannot add the xpath part of the xml due to the forum restriction. Im sure the way i have set my domain is not correct




Ảnh đại diện
Huỷ bỏ
Câu trả lời hay nhất

Hi, 

Please refer this forum answer and see if this gives you an idea.

https://www.odoo.com/forum/help-1/add-color-in-kanban-view-201666

Regards

Ảnh đại diện
Huỷ bỏ
Tác giả

I have a similar scenario with date. I want to set the card different color when todays date is greater or equal to deadlines date.

this is what i have:
<xpath expr="//div[contains(@t-attf-class, 'oe_kanban_card')]" position="attributes">
<attribute name="t-att-style">(record.date_deadline.value >= context_timestamp(datetime.date.today())) and 'background-color: #0adbf4;' or 'background-color: #09c05f;'</attribute>
</xpath>
and i get this error:
Uncaught Promise > Cannot read properties of undefined (reading 'date')