Suppose I have 2 models:
modela.py :
start_date = fields.Date('Date working')
modelb.py:
name = fields.Many2one('hr.employee', 'Employee')
start_datetime = fields.Datetime('Datetime working')
In modelb.py, I created 3 records via field name and start_datetime:
Employee Name Datetime working
A 10/18/2021 07.00
B 10/18/2021 08.00
C 10/18/2021 09.00
In modela.py, I selected via field start_date: 10/18/2021
and want to load ALL records of modelb.py which have: 10/18/2021 without going through time, via the function button using @onchange('Date')
I'd tried to convert the start_datetime from Datetime to Date in modelb.py First like this:
import dateutil.parser
start_datetime = fields.Datetime('Datetime working')
get_date = dateutil.parser.parse(start_datetime).date()
But I got Errors this way.
Note: I want to keep the format of the start_datetime field as Datetime.
So how to get/load Date from the Datetime field in Odoo 13?
Please help!
Thank you!
How to use timedelta in odoo python: https://learnopenerp.blogspot.com/2018/02/python-timedelta.html
Finally, I'd solved my requirement.
Using combine and timedelta to add an extra day as two conditions in the domain of @onchange.