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

How can I change a Datetime field to Date field based on a boolean?

is_half_day = fields.Boolean(string="Is half day?")
date_from = fields.Datetime('Start Date',
                            readonly=True,
                            index=True,
                            copy=False,
states={'draft': [('readonly', False)], 'confirm': [('readonly', False)]}, 
track_visibility='onchange')
date_to = fields.Datetime('End Date',
                            readonly=True,
                            copy=False,
                            states={'draft': [('readonly', False)], 'confirm': [('readonly', False)]},
                            track_visibility='onchange')

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

Hello Abdul Halim,
You can add extra fields for Date and add condition in Views to switch Datetime to Date like in Calendar Event / Meetings . Refer Image attached here. 

อวตาร
ละทิ้ง
Related Posts ตอบกลับ มุมมอง กิจกรรม
2
ก.พ. 24
3194
1
ส.ค. 23
4834
2
ก.ค. 24
14084
2
ธ.ค. 23
12677
3
ก.ค. 22
23023