How to find the difference in time from two diferent time
from dateutil import relativedelta

In this method we use 'relativedelta', you can import relativedelta from dateutil.

in this case, there are 2 fields date 'date_from' and 'date_to'.
we make variable diff for   

def _compute_duration(self):
  for i in self:
    diff = relativedelta.relativedelta(i.date_from, i.date_to)
    years = diff.years
    if years > 0:
       i.duration = str(years)+" Years "+str(diff.months)+" Months "+str(diff.days)+" Days"
     i.duration = str(diff.months) + " Months" + str(diff.days) + " Days"


def _compute_duration(self):
 for i in self:
  diff = relativedelta.relativedelta(i.test_end, i.test_start)
  hours = diff.hours
  if hours > 0:
    i.duration=str(hours)+" Hours "+str(diff.minutes)+" Minutes "+str(diff.seconds)+" Seconds"
    i.duration = str(diff.minutes) + " Minutes " + str(diff.seconds) + " Seconds"

Dashboard One2many di tampilan kanban
Cara Menampilkan Tampilan one2many pada dashboard kanban