=== modified file 'hr_holidays/report/holidays_summary_report.py' --- hr_holidays/report/holidays_summary_report.py 2011-08-18 13:31:19 +0000 +++ hr_holidays/report/holidays_summary_report.py 2011-08-24 10:19:40 +0000 @@ -21,6 +21,7 @@ import datetime import time +import string from osv import fields, osv from report.interface import report_rml @@ -114,24 +115,24 @@ else: type="Confirmed and Validated" holiday_type=('confirm','validate') - date_xml.append('%s\n'% (str(rml_obj.formatLang(som.strftime("%Y-%m-%d"),date=True)))) - date_xml.append('%s\n' %(str(rml_obj.formatLang(eom.strftime("%Y-%m-%d"),date=True)))) - date_xml.append('%s'%(type)) + date_xml.append(u'%s\n'% (str(rml_obj.formatLang(som.strftime("%Y-%m-%d"),date=True)))) + date_xml.append(u'%s\n' %(str(rml_obj.formatLang(eom.strftime("%Y-%m-%d"),date=True)))) + date_xml.append(u'%s'%(type)) # date_xml=[] for l in range(0,len(legend)): - date_xml += ['' % (l+1,legend[l][0],legend[l][1],legend[l][2])] + date_xml += [u'' % (l+1,legend[l][0],legend[l][1],legend[l][2])] - date_xml += ['' % (som.strftime('%B'), som.year),''] + date_xml += [u'' % (som.strftime('%B'), som.year),''] cell=1 if day_diff.days>=30: - date_xml += ['' % (x, som.replace(day=x).strftime('%a'),x-som.day+1) for x in range(som.day, lengthmonth(som.year, som.month)+1)] + date_xml += [u'' % (x, som.replace(day=x).strftime('%a'),x-som.day+1) for x in range(som.day, lengthmonth(som.year, som.month)+1)] else: if day_diff.days>=(lengthmonth(som.year, som.month)-som.day): - date_xml += ['' % (x, som.replace(day=x).strftime('%a'),x-som.day+1) for x in range(som.day, lengthmonth(som.year, som.month)+1)] + date_xml += [u'' % (x, som.replace(day=x).strftime('%a'),x-som.day+1) for x in range(som.day, lengthmonth(som.year, som.month)+1)] else: - date_xml += ['' % (x, som.replace(day=x).strftime('%a'),x-som.day+1) for x in range(som.day, eom.day+1)] + date_xml += [u'' % (x, som.replace(day=x).strftime('%a'),x-som.day+1) for x in range(som.day, eom.day+1)] cell=x-som.day+1 day_diff1=day_diff.days-cell+1 @@ -150,7 +151,7 @@ if month+i<=12: if day_diff1 > lengthmonth(year,i+month): # Not on 30 else you have problems when entering 01-01-2009 for example som1=datetime.date(year,month+i,1) - date_xml += ['' % (x, som1.replace(day=x).strftime('%a'),cell+x) for x in range(1, lengthmonth(year,i+month)+1)] + date_xml += [u'' % (x, som1.replace(day=x).strftime('%a'),cell+x) for x in range(1, lengthmonth(year,i+month)+1)] i=i+1 j=j+1 month_dict[j]=som1.strftime('%B') @@ -159,7 +160,7 @@ else: som1=datetime.date(year,month+i,1) - date_xml += ['' % (x, som1.replace(day=x).strftime('%a'),cell+x) for x in range(1, eom.day+1)] + date_xml += [u'' % (x, som1.replace(day=x).strftime('%a'),cell+x) for x in range(1, eom.day+1)] i=i+1 j=j+1 month_dict[j]=som1.strftime('%B') @@ -174,7 +175,7 @@ i=1 if day_diff1>=30: som1=datetime.date(years,i,1) - date_xml += ['' % (x, som1.replace(day=x).strftime('%a'),cell+x) for x in range(1, lengthmonth(years,i)+1)] + date_xml += [u'' % (x, som1.replace(day=x).strftime('%a'),cell+x) for x in range(1, lengthmonth(years,i)+1)] i=i+1 j=j+1 month_dict[j]=som1.strftime('%B') @@ -186,19 +187,19 @@ i=i+1 j=j+1 month_dict[j]=som1.strftime('%B') - date_xml += ['' % (x, som1.replace(day=x).strftime('%a'),cell+x) for x in range(1, eom.day+1)] + date_xml += [u'' % (x, som1.replace(day=x).strftime('%a'),cell+x) for x in range(1, eom.day+1)] cell=cell+x width_dict[j]=x day_diff1=day_diff1-x - date_xml.append('') - date_xml.append('3.5cm%s,0.4cm\n' % (',0.4cm' * (60))) + date_xml.append(u'') + date_xml.append(u'3.5cm%s,0.4cm\n' % (',0.4cm' * (60))) - st='3.5cm' + st=u'3.5cm' for m in range(1,len(width_dict)+1): st+=',' + str(0.4 *width_dict[m])+'cm' - st+=',0.4cm\n' + st+=u',0.4cm\n' months_xml =['' % (x,month_dict[x]) for x in range(1,len(month_dict)+1) ] months_xml.append(st) @@ -243,7 +244,7 @@ %s %s - ''' % (header_xml,months_xml,date_xml, ustr(emp_xml)) + ''' % (header_xml,months_xml,string.join(date_xml), ustr(emp_xml)) return xml