[FIX] hr_attendance : Bad reference of datetime library corrected

lp bug: https://launchpad.net/bugs/654931 fixed

bzr revid: jvo@tinyerp.com-20101006191921-mddqb2va4spzdo2x
This commit is contained in:
Jay (OpenERP)
2010-10-07 00:49:21 +05:30
parent 48c6af52fe
commit 209c2f59c8
+3 -3
View File
@@ -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