← Back to team overview

openerp-community-reviewer team mailing list archive

[Merge] lp:~agilebg/hr-timesheet/imp_hr_attendance_analysis_roundings into lp:hr-timesheet

 

Lorenzo Battistini - Agile BG has proposed merging lp:~agilebg/hr-timesheet/imp_hr_attendance_analysis_roundings into lp:hr-timesheet.

Requested reviews:
  HR Core Editors (hr-core-editors)

For more details, see:
https://code.launchpad.net/~agilebg/hr-timesheet/imp_hr_attendance_analysis_roundings/+merge/206493
-- 
https://code.launchpad.net/~agilebg/hr-timesheet/imp_hr_attendance_analysis_roundings/+merge/206493
Your team OpenERP Community Reviewer/Maintainer is subscribed to branch lp:hr-timesheet.
=== modified file 'hr_attendance_analysis/hr_attendance.py'
--- hr_attendance_analysis/hr_attendance.py	2013-08-30 10:27:51 +0000
+++ hr_attendance_analysis/hr_attendance.py	2014-02-14 14:16:08 +0000
@@ -26,6 +26,7 @@
 import time
 from datetime import *
 import math
+from openerp.tools import float_is_zero
 
 import pytz
 
@@ -76,8 +77,13 @@
 
     def time_difference(self, float_start_time, float_end_time):
         if float_end_time < float_start_time:
-            raise orm.except_orm(_('Error'), _('End time %s < start time %s')
-                % (str(float_end_time),str(float_start_time)))
+            if not float_is_zero(
+                float_start_time - float_end_time, precision_rounding=0.0000001
+                # that means a difference smaller than 0.36 milliseconds
+            ):
+                raise orm.except_orm(
+                    _('Error'), _('End time %s < start time %s')
+                    % (str(float_end_time),str(float_start_time)))
         delta = self.float_to_datetime(float_end_time) - self.float_to_datetime(
             float_start_time)
         return self.total_seconds(delta) / 60.0 / 60.0


Follow ups