← Back to team overview

openerp-dev-web team mailing list archive

[Merge] lp:~openerp-commiter/openobject-addons/trunk-dev-addons3-mtr1 into lp:~openerp-dev/openobject-addons/trunk-dev-addons3

 

Meera Trambadia (OpenERP) has proposed merging lp:~openerp-commiter/openobject-addons/trunk-dev-addons3-mtr1 into lp:~openerp-dev/openobject-addons/trunk-dev-addons3.

Requested reviews:
  OpenERP R&D Team (openerp-dev)
Related bugs:
  #600547 Invoice totals not updated when a line is moved (store={...} bug?)
  https://bugs.launchpad.net/bugs/600547
  #690895 copy account.move crash 
  https://bugs.launchpad.net/bugs/690895
  #694144 [6.0] sales manager dashboard - sales by month - sql query error, usabiliy
  https://bugs.launchpad.net/bugs/694144
  #695632 [RC1]Two same fields creating problem in web-client
  https://bugs.launchpad.net/bugs/695632
  #695960 [6.0RC1][hr_timesheet]Problems printing timesheet reports
  https://bugs.launchpad.net/bugs/695960
  #702805 an employee shouldn't be able to see expenses and holidays of others employee
  https://bugs.launchpad.net/bugs/702805
  #703836 [Trunk] hr_expense: Invoice button not working
  https://bugs.launchpad.net/bugs/703836
  #705766 Wrong Picked Widget in Sale Order in OpenERP v6.0.1
  https://bugs.launchpad.net/bugs/705766
  #707144 [6.0] hr_payroll 'C/D' versus 'D/C' 
  https://bugs.launchpad.net/bugs/707144
  #708603 Miscalculation of parent_store data when moving multiple records under same parent
  https://bugs.launchpad.net/bugs/708603
  #711533 v6 hr_attendance - time is rounded to hour
  https://bugs.launchpad.net/bugs/711533

For more details, see:
https://code.launchpad.net/~openerp-commiter/openobject-addons/trunk-dev-addons3-mtr1/+merge/48584

[FIX] hr_attendance:'Attendance by month' and 'Weekly Attendance' report now prints minutes also --fixes lp:711533 
-- 
https://code.launchpad.net/~openerp-commiter/openobject-addons/trunk-dev-addons3-mtr1/+merge/48584
Your team OpenERP R&D Team is requested to review the proposed merge of lp:~openerp-commiter/openobject-addons/trunk-dev-addons3-mtr1 into lp:~openerp-dev/openobject-addons/trunk-dev-addons3.
=== modified file 'hr_attendance/report/attendance_by_month.py'
--- hr_attendance/report/attendance_by_month.py	2011-02-02 10:40:49 +0000
+++ hr_attendance/report/attendance_by_month.py	2011-02-04 09:02:13 +0000
@@ -85,7 +85,13 @@
                     for att in attendences:
                         dt = datetime.strptime(att['name'], '%Y-%m-%d %H:%M:%S')
                         if ldt and att['action'] == 'sign_out':
-                            wh += (dt - ldt).seconds/60/60
+                           tot_time = (dt - ldt).seconds
+                           hrs, remainder = divmod(tot_time, 3600)
+                           min, sec = divmod(remainder, 60)
+                           if min < 10:
+                               wh += float((str(hrs))+ '.' + '0' +(str(min)))
+                           else:
+                               wh += float((str(hrs))+ '.' + (str(min)))
                         else:
                             ldt = dt
                     # Week xml representation

=== modified file 'hr_attendance/report/timesheet.py'
--- hr_attendance/report/timesheet.py	2011-01-17 18:02:22 +0000
+++ hr_attendance/report/timesheet.py	2011-02-04 09:02:13 +0000
@@ -43,7 +43,7 @@
         end_date = datetime.strptime(datas['form']['end_date'], '%Y-%m-%d')
         first_monday = start_date - relativedelta(days=start_date.date().weekday())
         last_monday = end_date + relativedelta(days=7 - end_date.date().weekday())
-        
+
         if last_monday < first_monday:
             first_monday, last_monday = last_monday, first_monday
 
@@ -80,10 +80,18 @@
                         attendances.append({'name': n_monday.strftime('%Y-%m-%d %H:%M:%S'), 'action': 'sign_out'})
                     # sum up the attendances' durations
                     ldt = None
+                    wh = 0.0
                     for att in attendances:
                         dt = datetime.strptime(att['name'], '%Y-%m-%d %H:%M:%S')
                         if ldt and att['action'] == 'sign_out':
-                            week_wh[ldt.date().weekday()] = week_wh.get(ldt.date().weekday(), 0) + ((dt - ldt).seconds/3600)
+                           tot_time = (dt - ldt).seconds
+                           hrs, remainder = divmod(tot_time, 3600)
+                           min, sec = divmod(remainder, 60)
+                           if min < 10:
+                               wh = float((str(hrs))+ '.' + '0' +(str(min)))
+                           else:
+                               wh = float((str(hrs))+ '.' + (str(min)))
+                           week_wh[ldt.date().weekday()] = week_wh.get(ldt.date().weekday(), 0) + round(wh,2)
                         else:
                             ldt = dt
 
@@ -92,10 +100,10 @@
                 for idx in range(7):
                     week_repr.append('<%s>' % num2day[idx])
                     if idx in week_wh:
-                        week_repr.append('<workhours>%sh%02d</workhours>' % to_hour(week_wh[idx]))
+                        week_repr.append('<workhours>%s</workhours>' %(week_wh[idx]))
                     week_repr.append('</%s>' % num2day[idx])
                 week_repr.append('<total>')
-                week_repr.append('<worked>%sh%02d</worked>' % to_hour(reduce(lambda x,y:x+y, week_wh.values(), 0)))
+                week_repr.append('<worked>%s</worked>' % sum(week_wh.values()))
                 week_repr.append('</total>')
                 week_repr.append('</week>')
                 if len(week_repr) > 21: # 21 = minimal length of week_repr