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

I desperately need to be able to change the color of calendar entries depending on a custom field value. There are about 5 different colors I need to be able to choose depending on this custom field.

Does anyone know how to do this?

I've spent hours, and hours, and hours pouring through code to no avail.


I'm using Odoo 17.


Thank you.

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

can you please explain more, are you creating you custom field in "calendar.event" model?

Tác giả Câu trả lời hay nhất

Yes I am creating a custom field in calendar.event which is a Many2one of type appointment_status_ids where appointment_status is defined as such:




Then in my XML for calendar.event, I have this to let the user pick it:




And finally, I try to use it as the background color for the calendar events like this, in another XML file that gets loaded:

But none of this works.

If I use Studio and choose the "color" attribute to point to my appointment_status_ids field, as long as I stay in Studio I can see the calendar picking a different color for each status! (However, not the colors I chose for each status object, but one thing at a time...)

As soon as I save Studio changes, the calendar goes back to using the color of the appointment/meeting attendee (some horrible yellow).

Any ideas?


Ảnh đại diện
Huỷ bỏ
Bài viết liên quan Trả lời Lượt xem Hoạt động
1
thg 5 21
15936
1
thg 7 25
675
2
thg 6 25
1116
1
thg 5 25
2582
1
thg 4 25
3778