Skip to Content
Menu
This question has been flagged
1 Reply
5936 Views

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')

Avatar
Discard
Best Answer

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. 

Avatar
Discard
Related Posts Replies Views Activity
2
Feb 24
1751
1
Aug 23
3389
2
Jul 24
12604
2
Dec 23
11087
3
Jul 22
20949