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

Hello,

I would like to create a filter on the attendance module to show entries that checked-in after 7am (regardless of the date). I tried the following and it is not working:


filter domain="[['check_in', '>', check_in.replace(hour=7, minute=0)]]" string="Late"/>


Any idea will be appreciated. Thanks!

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

Hi ,

<filter name="late" string="Late" domain="[('schedule_date','&gt;=', datetime.datetime.combine(context_today(), datetime.time(7,0,0))), ('schedule_date','&lt;=', datetime.datetime.combine(context_today(), datetime.time(23,59,59)))]"/>

Hope it Helps,

Kiran K

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

Hi Kiran,

This is almost what I wanted but not entirely correct, because it only returns the entries that are after 7am of the current date. I would like to get the late check-ins regardless of the date. I hope it make sense

Câu trả lời hay nhất
You can use this if you want to filter Datetime field just by date:

<field name="min_date" widget="date" filter_domain="[('min_date','>=',self+' 00:00:00'),('min_date','<=',self+' 23:59:59')]"/>


Ảnh đại diện
Huỷ bỏ
Bài viết liên quan Trả lời Lượt xem Hoạt động
2
thg 8 25
1667
3
thg 7 25
2438
1
thg 7 25
2045
0
thg 1 25
1471
1
thg 12 24
1921