From 209c2f59c88aaf9271a9834c7e1e31f6b83bd102 Mon Sep 17 00:00:00 2001 From: "Jay (OpenERP)" Date: Thu, 7 Oct 2010 00:49:21 +0530 Subject: [PATCH] [FIX] hr_attendance : Bad reference of datetime library corrected lp bug: https://launchpad.net/bugs/654931 fixed bzr revid: jvo@tinyerp.com-20101006191921-mddqb2va4spzdo2x --- addons/hr_attendance/report/timesheet.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/addons/hr_attendance/report/timesheet.py b/addons/hr_attendance/report/timesheet.py index 1465be81bc8..096de11664e 100644 --- a/addons/hr_attendance/report/timesheet.py +++ b/addons/hr_attendance/report/timesheet.py @@ -41,8 +41,8 @@ class report_custom(report_rml): start_date = datetime.strptime(datas['form']['init_date'], '%Y-%m-%d') end_date = datetime.strptime(datas['form']['end_date'], '%Y-%m-%d') - first_monday = start_date - relativedelta(days=start_date.day_of_week) - last_monday = end_date + relativedelta(days=7 - end_date.day_of_week) + 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 @@ -82,7 +82,7 @@ class report_custom(report_rml): for att in attendances: dt = datetime.strptime(att['name'], '%Y-%m-%d %H:%M:%S') if att['action'] == 'sign_out': - week_wh[ldt.day_of_week] = week_wh.get(ldt.day_of_week, 0) + (dt - ldt).hours + week_wh[ldt.date().weekday()] = week_wh.get(ldt.date().weekday(), 0) + (dt - ldt).hours ldt = dt # Week xml representation