I use below example for round time in odoo.
@api.one
@api.depends('start','finish','pause')
def total(self):
for rec in self:
time1 = datetime.strptime(rec.start, "%Y-%m-%d %H:%M:%S")
time2 = datetime.strptime(rec.finish, "%Y-%m-%d %H:%M:%S")
rec.total_time = round(((time2 - time1).seconds / float(60*60) - self.pause))
For example:
if start = 07:57:21 , finish = 16:25:36, pause = 1 get result 7 hours
if start = 07:57:34 , finish = 16:28:42, pause = 1 get result 8 hours
First and second time different is 3 minutes but in result that is one hours!
How change round if total time >= 7 hours 30 minutes 01 second I need result 8 in other solution 7.5 (7 hours and 30 minutes)
in other solution 7 or 7.5?? Do you want 7 or 7.5? - qvphamround(7.5)==8andround(7.4)==7==int(7.4)andround(7.6)==8==int(7.6+1)- khelili milianaround(7.5001) = 8,round(7.4)=7,round(7.5)=7.5? - qvpham