hr_schedule Exception Rules not accurate for attendance and schedule on different time zone

Bug #1358848 reported by Aldennis
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Human Resources - Next Generation for OpenERP
New
Undecided
Unassigned

Bug Description

OpenERP server installed on Ubuntu with PHT locale (GMT+8)
All time are in PHT (GMT +8)

Prerequisite module: hr_payroll_extension, hr_schedule

Steps to produce:

1st problem:

1. Create an Employee and assign a contract then confirm it. (Do not use the default OpenERP demo employee since it cause an error that has something to do with assigning job_id. You need to create a new one)

2. Create a schedule for the employee on April 1, 2014 (any first day of the month will do) from 09:30 to 17:50 then save it. (OpenERP records this as 2014-04-01 01:30 and 2014-04-01 09:50 )

3. Create a payroll period for April 1 to 30 2014 with the type Monthly and Timezone Asia/Manila (or any GMT +8 w/o DST)

4. OpenERP save the payroll period with start date = 2014-03-31 16:00:00 and end date 2014-04-30 15:59:59. (Why? Because OpenERP 7.0 server always saves the datetime value in UTC)

5. Create a Sign In and Sign Out attendance record at the same time of the schedule

6. Go to End of Pay Period menu and click the End of Pay Period Wizard.

7. On Step 1. Check Attendance Records click the Re-check button. No matter what you do, you will always have a misattendance because the system starts at 2014-03-31 with a stripped hour.

The function _do_recalc_alerts on hr_payroll_period/wizard/payroll_period_end.py line 621 is responsible for this. The period as saved in the database has a start date of "2014-03-31 16:00:00". It's time was stripped to "2014-03-31 00:00:00" at line 646 when it is passed as an argument to the function compute_alerts_by_employee on hr_schedule/hr_schedule.py line 1062.

Regardless whether the compute_alerts_by_employee function converts it to local time (line 1062 to 1067 of hr_schedule.py) it remains on "2014-03-31" where it would not find a match for the schedule and attendance.

2nd problem:

The function compute_alerts_by_employee of hr_schedule.py searches for the sched_details_ids using the field 'day' of 'hr.schedule.detail' object which is only a date field (line 1071 of hr_schedule.py) while it searches for attendance_ids of 'hr.attendance' object using the field 'name' which is a datetime field. This cause the sched_details not matching the attendance_ids when compared using the check_rule function (line 1096)

Attached is the original hr_schedule and hr_payroll_period module (dependency module not included) and the fix I've created

Revision history for this message
Aldennis (alagumbay) wrote :
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.