Try with this example:
from dateutil.relativedelta import relativedelta
@api.one
@api.depends('start_field','finish_field')
def _total_minutes(self):
if self.start_field and self.finish_field:
start_dt = fields.Datetime.from_string(self.start_field)
finish_dt = fields.Datetime.from_string(self.finish_field)
difference = relativedelta(finish_dt, start_dt)
days = difference.days
hours = difference.hours
minutes = difference.minutes
seconds = 0
1
solved Calculate difference between two datetimes odoo 10 [duplicate]