Merge lp:~agilebg/hr-timesheet/hr_attendance_analysis-imp-time_difference-message into lp:~hr-core-editors/hr-timesheet/7.0

Proposed by Lorenzo Battistini
Status: Work in progress
Proposed branch: lp:~agilebg/hr-timesheet/hr_attendance_analysis-imp-time_difference-message
Merge into: lp:~hr-core-editors/hr-timesheet/7.0
Diff against target: 86 lines (+28/-10)
2 files modified
hr_attendance_analysis/hr_attendance.py (+14/-6)
hr_attendance_analysis/wizard/print_calendar_report.py (+14/-4)
To merge this branch: bzr merge lp:~agilebg/hr-timesheet/hr_attendance_analysis-imp-time_difference-message
Reviewer Review Type Date Requested Status
Alex Comba - Agile BG (community) Disapprove
Pedro Manuel Baeza Needs Resubmitting
Review via email: mp+225275@code.launchpad.net

Description of the change

This allows, when time diff errors are raised, to identify the raising attendance

To post a comment you must log in.
71. By Lorenzo Battistini

[FIX] syntax error

72. By Lorenzo Battistini

[imp] wizard error messages

73. By Lorenzo Battistini

[IMP] wizard error message

Revision history for this message
Pedro Manuel Baeza (pedro.baeza) wrote :

This project is now hosted on https://github.com/OCA/hr-timesheet. Please move your proposal there. This guide may help you https://github.com/OCA/maintainers-tools/wiki/How-to-move-a-Merge-Proposal-to-GitHub

review: Needs Resubmitting
Revision history for this message
Alex Comba - Agile BG (tafaru) wrote :

Moved to https://github.com/OCA/hr-timesheet/pull/7
I prefer do not delete the proposal to keep all the associated comments that have been made.

review: Disapprove

Unmerged revisions

73. By Lorenzo Battistini

[IMP] wizard error message

72. By Lorenzo Battistini

[imp] wizard error messages

71. By Lorenzo Battistini

[FIX] syntax error

70. By Lorenzo Battistini

[IMP] time_difference error msg
This allows, when time diff errors are raised, to identify the raising attendance

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'hr_attendance_analysis/hr_attendance.py'
--- hr_attendance_analysis/hr_attendance.py 2014-05-21 22:04:08 +0000
+++ hr_attendance_analysis/hr_attendance.py 2014-07-02 12:01:10 +0000
@@ -75,16 +75,21 @@
75 def total_seconds(self, td):75 def total_seconds(self, td):
76 return (td.microseconds + (td.seconds + td.days * 24 * 3600) * 10**6) / 10**676 return (td.microseconds + (td.seconds + td.days * 24 * 3600) * 10**6) / 10**6
7777
78 def time_difference(self, float_start_time, float_end_time):78 def time_difference(
79 self, float_start_time, float_end_time, help_message=False
80 ):
79 if float_compare(81 if float_compare(
80 float_end_time, float_start_time, precision_rounding=0.000000182 float_end_time, float_start_time, precision_rounding=0.0000001
81 ) == -1:83 ) == -1:
82 # that means a difference smaller than 0.36 milliseconds84 # that means a difference smaller than 0.36 milliseconds
85 message = _('End time %s < start time %s %s') % (
86 str(float_end_time),
87 str(float_start_time),
88 help_message and '(' + help_message + ')' or ''
89 )
83 raise orm.except_orm(90 raise orm.except_orm(
84 _('Error'),91 _('Error'),
85 _('End time %s < start time %s') % (92 message
86 str(float_end_time), str(float_start_time)
87 )
88 )93 )
89 delta = self.float_to_datetime(94 delta = self.float_to_datetime(
90 float_end_time) - self.float_to_datetime(95 float_end_time) - self.float_to_datetime(
@@ -329,9 +334,12 @@
329 res[attendance.id]['inside_calendar_duration'] = intervals_within * precision334 res[attendance.id]['inside_calendar_duration'] = intervals_within * precision
330 # make difference using time in order to avoid rounding errors335 # make difference using time in order to avoid rounding errors
331 # inside_calendar_duration can't be > duration336 # inside_calendar_duration can't be > duration
332 res[attendance.id]['outside_calendar_duration'] = self.time_difference(337 res[attendance.id][
338 'outside_calendar_duration'
339 ] = self.time_difference(
333 res[attendance.id]['inside_calendar_duration'],340 res[attendance.id]['inside_calendar_duration'],
334 res[attendance.id]['duration'])341 res[attendance.id]['duration'],
342 help_message='Attendance ID %s' % attendance.id)
335343
336 if reference_calendar.overtime_rounding:344 if reference_calendar.overtime_rounding:
337 if res[attendance.id]['outside_calendar_duration']:345 if res[attendance.id]['outside_calendar_duration']:
338346
=== modified file 'hr_attendance_analysis/wizard/print_calendar_report.py'
--- hr_attendance_analysis/wizard/print_calendar_report.py 2013-11-19 13:32:00 +0000
+++ hr_attendance_analysis/wizard/print_calendar_report.py 2014-07-02 12:01:10 +0000
@@ -167,8 +167,14 @@
167 datetime.strptime(calendar_attendance.date_from,'%Y-%m-%d')167 datetime.strptime(calendar_attendance.date_from,'%Y-%m-%d')
168 <= current_date168 <= current_date
169 )):169 )):
170 calendar_attendance_duration = attendance_pool.time_difference(170 calendar_attendance_duration = (
171 calendar_attendance.hour_from, calendar_attendance.hour_to)171 attendance_pool.time_difference(
172 calendar_attendance.hour_from,
173 calendar_attendance.hour_to,
174 help_message=(
175 'Calendar attendance ID %s'
176 % calendar_attendance.id))
177 )
172 if calendar_attendance_duration < 0:178 if calendar_attendance_duration < 0:
173 raise orm.except_orm(_('Error'),179 raise orm.except_orm(_('Error'),
174 _("%s: 'Work to' is < 'Work from'")180 _("%s: 'Work to' is < 'Work from'")
@@ -219,14 +225,18 @@
219 'leaves'225 'leaves'
220 ] = days_by_employee[employee_id][str_current_date]['due']226 ] = days_by_employee[employee_id][str_current_date]['due']
221 due_minus_leaves = attendance_pool.time_difference(227 due_minus_leaves = attendance_pool.time_difference(
222 current_total_leaves, current_total_due)228 current_total_leaves, current_total_due,
229 help_message='Employee ID %s. Date %s' % (
230 employee_id, str_current_date))
223 if due_minus_leaves < current_total_inside_calendar:231 if due_minus_leaves < current_total_inside_calendar:
224 days_by_employee[employee_id][str_current_date]['negative'] = 0.0232 days_by_employee[employee_id][str_current_date]['negative'] = 0.0
225 else:233 else:
226 days_by_employee[employee_id][str_current_date][234 days_by_employee[employee_id][str_current_date][
227 'negative'235 'negative'
228 ] = attendance_pool.time_difference(236 ] = attendance_pool.time_difference(
229 current_total_inside_calendar, due_minus_leaves)237 current_total_inside_calendar, due_minus_leaves,
238 help_message='Employee ID %s. Date %s' % (
239 employee_id, str_current_date))
230240
231 if reference_calendar:241 if reference_calendar:
232 if reference_calendar.leave_rounding:242 if reference_calendar.leave_rounding:

Subscribers

People subscribed via source and target branches