title: Updating table fields
body: <p>There is an odoo system with a timesheet module (self-made) in it. 
  How it works: worker came — time of the arrival has written in the timesheet — everything's good.
  But there is a problem: employees, responsible for making such records, are using different timing formats: some of them are using standart HH:MM (e.g. 10:30) and some of them are using tenths HH:T (e.g. 10.5, which means the same 10:30 or even 10.125 (10:08)), so I had to make a convertation function. </p>
  
  <p>Job's done, it works, but I bet there is a way to optimize it. At least, the last part of it.</p>
  
  <pre><code>@api.one
  def time_button (self):
      def ftohhmm(a):
         if a:
            a = re.sub(',' , '.' , a)
            if (re.search ('^\-?\d+((,|\.)\d+)?$',a) &gt;= 0): 
               if float(a) &lt;24: 
                  a = float(a) * 60
                  minutes = a%60
                  hours = a/60
                  if int(round(minutes)) &lt; 10:
                     return str(int(hours))+":0"+str(int(round(minutes)))
                  else:
                     return str(int(hours))+":"+str(int(round(minutes)))
         return a
      if self.format:
         for i in self.ids_string:
            i.hours1=ftohhmm(i.hours1)
            i.hours2=ftohhmm(i.hours2)
            i.hours3=ftohhmm(i.hours3)
            i.hours4=ftohhmm(i.hours4)
            i.hours5=ftohhmm(i.hours5)
            i.hours6=ftohhmm(i.hours6)
            i.hours7=ftohhmm(i.hours7)
            i.hours8=ftohhmm(i.hours8)
            i.hours9=ftohhmm(i.hours9)
            i.hours10=ftohhmm(i.hours10)
            i.hours11=ftohhmm(i.hours11)
            i.hours12=ftohhmm(i.hours12)
            i.hours13=ftohhmm(i.hours13)
            i.hours14=ftohhmm(i.hours14)
            i.hours15=ftohhmm(i.hours15)
            i.hours16=ftohhmm(i.hours16)
            i.hours17=ftohhmm(i.hours17)
            i.hours18=ftohhmm(i.hours18)
            i.hours19=ftohhmm(i.hours19)
            i.hours20=ftohhmm(i.hours20)
            i.hours21=ftohhmm(i.hours21)
            i.hours22=ftohhmm(i.hours22)
            i.hours23=ftohhmm(i.hours23)
            i.hours24=ftohhmm(i.hours24)
            i.hours25=ftohhmm(i.hours25)
            i.hours26=ftohhmm(i.hours26)
            i.hours27=ftohhmm(i.hours27)
            i.hours28=ftohhmm(i.hours28)
            i.hours29=ftohhmm(i.hours29)
            i.hours30=ftohhmm(i.hours30)
            i.hours31=ftohhmm(i.hours31)
  </code></pre>
  
  <p>Hours1-31 are the columns for every day. Rows are for workers. Cells at the intersections contain exact time when worker came.</p>
  
  <p>Any advise of how to optimize it would be great. Thanks!</p>