[IMP] hr_attendance: added column for total in 'Attendance by Month' report

bzr revid: cha@tinyerp.com-20121015093009-69xzo9iutecnhnc5
This commit is contained in:
Ajay Chauhan (OpenERP) 2012-10-15 15:00:09 +05:30
parent 3e92ab21d0
commit ece648faed
1 changed files with 7 additions and 1 deletions

View File

@ -57,6 +57,7 @@ class report_custom(report_rml):
if emp_ids:
for emp in obj_emp.read(cr, uid, emp_ids, ['name']):
stop, days_xml = False, []
total_wh = 0.0
user_repr = '''
<user>
<name>%s</name>
@ -90,11 +91,15 @@ class report_custom(report_rml):
else:
ldt = dt
# Week xml representation
total_wh += wh
wh = hour2str(wh)
today_xml = '<day num="%s"><wh>%s</wh></day>' % ((today - month).days+1, (wh))
dy=(today - month).days+1
days_xml.append(today_xml)
today, tomor = tomor, tomor + one_day
total_wh = hour2str(total_wh)
today_xml = '<day num="Total"><wh>%s</wh></day>' % (total_wh)
days_xml.append(today_xml)
user_xml.append(user_repr % '\n'.join(days_xml))
rpt_obj = pooler.get_pool(cr.dbname).get('hr.employee')
@ -172,8 +177,9 @@ class report_custom(report_rml):
cell=cell+x
width_dict[j]=x
day_diff1=day_diff1-x
date_xml += ['<dayy number="Total" cell="Total"/>']
date_xml.append('</days>')
date_xml.append('<cols>3.5cm%s</cols>\n' % (',0.74cm' * (int(dy))))
date_xml.append('<cols>3.5cm%s,1.2cm</cols>\n' % (',0.74cm' * (int(dy))))
xml = '''<?xml version="1.0" encoding="UTF-8" ?>
<report>
%s