[FIX] weekly,monthly report problem in hr module

bzr revid: shp@tinyerp.com-20121004130606-ju9ahpnk20qxeeyr
This commit is contained in:
pankita shah (Open ERP) 2012-10-04 18:36:06 +05:30
parent ba97319054
commit f00e26b9ca
3 changed files with 5 additions and 2 deletions

View File

@ -84,8 +84,10 @@ class report_custom(report_rml):
# sum up the attendances' durations
ldt = None
for att in attendences:
dt = datetime.strptime(att['name'], '%Y-%m-%d %H:%M:%S')
dt = datetime.strptime(att['name'], '%Y-%m-%d %H:%M:%S')
if ldt and att['action'] == 'sign_out':
if dt.date() > ldt.date():
dt = ldt
wh += (float((dt - ldt).seconds)/60/60)
else:
ldt = dt

View File

@ -38,7 +38,7 @@ class report_custom(report_rml):
def create_xml(self, cr, uid, ids, datas, context=None):
obj_emp = pooler.get_pool(cr.dbname).get('hr.employee')
ids = datas['active_ids']
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.date().weekday())

View File

@ -37,6 +37,7 @@ class hr_attendance_byweek(osv.osv_memory):
def print_report(self, cr, uid, ids, context=None):
datas = {
'ids': [],
'active_ids': context['active_ids'],
'model': 'hr.employee',
'form': self.read(cr, uid, ids)[0]
}