title: how to make difference between two datetime fields result in hours , odoo?
body: <p>i want to do the difference b/w two datetime fields and the result is in hours. i am not getting any error but this is not working. can anyone please help with this.</p>
  
  <pre><code>@api.one
  @api.onchange('end_production_date')
  def onchange_production_dates(self):
      begin_production_date=self.begin_production_date
      end_production_date=self.end_production_date
      production_duration=self.production_duration
  
      value = {}
      if not begin_production_date:
          return value
      if not end_production_date and not production_duration:
          duration = 1.00
          value[production_duration] = duration
  
      start = datetime.strptime(begin_production_date, "%Y-%m-%d %H:%M:%S")
      if end_production_date and not production_duration:
          end = datetime.strptime(end_production_date, "%Y-%m-%d %H:%M:%S")
          diff = end - start
          duration = float(diff.days)* 24 + (float(diff.seconds) / 3600)
          value[production_duration] = round(duration, 2)
      elif not end_production_date:
          end = start + timedelta(hours=production_duration)
          value[end_production_date] = end.strftime("%Y-%m-%d %H:%M:%S")
      elif end_production_date and production_duration:
          end = datetime.strptime(end_production_date, "%Y-%m-%d %H:%M:%S")
          diff = end - start
          duration = float(diff.days)* 24 + (float(diff.seconds) / 3600)
          value['production_duration'] = round(duration, 2)
  
      return {'value': value}
  </code></pre>
  
  <p>Thanks</p>