Meera Trambadia (OpenERP) has proposed merging 
lp:~openerp-dev/openobject-addons/trunk-bug-798721-mtr into 
lp:openobject-addons.

Requested reviews:
  OpenERP Core Team (openerp)
Related bugs:
  Bug #798721 in OpenERP Addons: "[PS] Reports not translated on the employee 
form"
  https://bugs.launchpad.net/openobject-addons/+bug/798721

For more details, see:
https://code.launchpad.net/~openerp-dev/openobject-addons/trunk-bug-798721-mtr/+merge/66069

hr_attendance, hr_holidays:monthly attendance and holidays summary report are 
now translated" --fixes=lp:798721

-- 
https://code.launchpad.net/~openerp-dev/openobject-addons/trunk-bug-798721-mtr/+merge/66069
Your team OpenERP R&D Team is subscribed to branch 
lp:~openerp-dev/openobject-addons/trunk-bug-798721-mtr.
=== modified file 'hr_attendance/report/attendance_by_month.py'
--- hr_attendance/report/attendance_by_month.py	2011-02-07 09:36:21 +0000
+++ hr_attendance/report/attendance_by_month.py	2011-06-28 05:32:27 +0000
@@ -30,9 +30,10 @@
 
 from report import report_sxw
 from tools import ustr
+from tools.translate import _
 
 one_day = relativedelta(days=1)
-month2name = [0, 'January', 'February', 'March', 'April', 'May', 'Jun', 'July', 'August', 'September', 'October', 'November', 'December']
+month2name = [0, 'January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December']
 
 def hour2str(h):
     hours = int(h)
@@ -52,7 +53,7 @@
             context = {}
         month = datetime(datas['form']['year'], datas['form']['month'], 1)
         emp_ids = context.get('active_ids', [])
-        user_xml = ['<month>%s</month>' % month2name[month.month], '<year>%s</year>' % month.year]
+        user_xml = ['<month>%s</month>' % _(month2name[month.month]), '<year>%s</year>' % month.year]
         if emp_ids:
             for emp in obj_emp.read(cr, uid, emp_ids, ['name']):
                 stop, days_xml = False, []
@@ -95,7 +96,7 @@
                     days_xml.append(today_xml)
                     today, tomor = tomor, tomor + one_day
                 user_xml.append(user_repr % '\n'.join(days_xml))
-
+                
         rpt_obj = pooler.get_pool(cr.dbname).get('hr.employee')
         rml_obj=report_sxw.rml_parse(cr, uid, rpt_obj._name,context)
         header_xml = '''
@@ -113,12 +114,12 @@
         cell=1
         date_xml.append('<days>')
         if day_diff.days>=30:
-            date_xml += ['<dayy number="%d" name="%s" cell="%d"/>' % (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 += ['<dayy number="%d" name="%s" cell="%d"/>' % (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 += ['<dayy number="%d" name="%s" cell="%d"/>' % (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 += ['<dayy number="%d" name="%s" cell="%d"/>' % (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 += ['<dayy number="%d" name="%s" cell="%d"/>' % (x, som.replace(day=x).strftime('%a'),x-som.day+1) for x in range(som.day, eom.day+1)]
+                date_xml += ['<dayy number="%d" name="%s" cell="%d"/>' % (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
         width_dict={}
@@ -129,12 +130,12 @@
         month=som.month
         month_dict[j]=som.strftime('%B')
         width_dict[j]=cell
-
+        
         while day_diff1>0:
             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 += ['<dayy number="%d" name="%s" cell="%d"/>' % (x, som1.replace(day=x).strftime('%a'),cell+x) for x in range(1, lengthmonth(year,i+month)+1)]
+                    date_xml += ['<dayy number="%d" name="%s" cell="%d"/>' % (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')
@@ -142,7 +143,7 @@
                     width_dict[j]=x
                 else:
                     som1=datetime.date(year,month+i,1)
-                    date_xml += ['<dayy number="%d" name="%s" cell="%d"/>' % (x, som1.replace(day=x).strftime('%a'),cell+x) for x in range(1, eom.day+1)]
+                    date_xml += ['<dayy number="%d" name="%s" cell="%d"/>' % (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')
@@ -156,7 +157,7 @@
                 i=1
                 if day_diff1>=30:
                     som1=datetime.date(years,i,1)
-                    date_xml += ['<dayy number="%d" name="%s" cell="%d"/>' % (x, som1.replace(day=x).strftime('%a'),cell+x) for x in range(1, lengthmonth(years,i)+1)]
+                    date_xml += ['<dayy number="%d" name="%s" cell="%d"/>' % (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')
@@ -167,7 +168,7 @@
                     i=i+1
                     j=j+1
                     month_dict[j]=som1.strftime('%B')
-                    date_xml += ['<dayy number="%d" name="%s" cell="%d"/>' % (x, som1.replace(day=x).strftime('%a'),cell+x) for x in range(1, eom.day+1)]
+                    date_xml += ['<dayy number="%d" name="%s" cell="%d"/>' % (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

=== modified file 'hr_holidays/report/holidays_summary_report.py'
--- hr_holidays/report/holidays_summary_report.py	2011-01-17 18:02:22 +0000
+++ hr_holidays/report/holidays_summary_report.py	2011-06-28 05:32:27 +0000
@@ -30,6 +30,7 @@
 import time
 from report import report_sxw
 from tools import ustr
+from tools.translate import _
 
 def lengthmonth(year, month):
     if month == 2 and ((year % 4 == 0) and ((year % 100 != 0) or (year % 400 == 0))):
@@ -69,9 +70,9 @@
          for index in range(1,61):
               display[index]=' '
               count=''
-
+              
     data_xml=['<info id="%d" number="%d" val="%s" />' % (row_id,x,display[x]) for x in range(1,len(display)+1) ]
-
+    
     # Computing the xml
     xml = '''
     %s
@@ -120,18 +121,17 @@
 
 #        date_xml=[]
         for l in range(0,len(legend)):
-            date_xml += ['<legend row="%d" id="%d" name="%s" color="%s" />' % (l+1,legend[l][0],legend[l][1],legend[l][2])]
-
+            date_xml += ['<legend row="%d" id="%d" name="%s" color="%s" />' % (l+1,legend[l][0],_(legend[l][1]),legend[l][2])]
         date_xml += ['<date month="%s" year="%d" />' % (som.strftime('%B'), som.year),'<days>']
 
         cell=1
         if day_diff.days>=30:
-            date_xml += ['<dayy number="%d" name="%s" cell="%d"/>' % (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 += ['<dayy number="%d" name="%s" cell="%d"/>' % (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 += ['<dayy number="%d" name="%s" cell="%d"/>' % (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 += ['<dayy number="%d" name="%s" cell="%d"/>' % (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 += ['<dayy number="%d" name="%s" cell="%d"/>' % (x, som.replace(day=x).strftime('%a'),x-som.day+1) for x in range(som.day, eom.day+1)]
+                date_xml += ['<dayy number="%d" name="%s" cell="%d"/>' % (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 +150,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 += ['<dayy number="%d" name="%s" cell="%d"/>' % (x, som1.replace(day=x).strftime('%a'),cell+x) for x in range(1, lengthmonth(year,i+month)+1)]
+                    date_xml += ['<dayy number="%d" name="%s" cell="%d"/>' % (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 +159,7 @@
 
                 else:
                     som1=datetime.date(year,month+i,1)
-                    date_xml += ['<dayy number="%d" name="%s" cell="%d"/>' % (x, som1.replace(day=x).strftime('%a'),cell+x) for x in range(1, eom.day+1)]
+                    date_xml += ['<dayy number="%d" name="%s" cell="%d"/>' % (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 +174,7 @@
                 i=1
                 if day_diff1>=30:
                     som1=datetime.date(years,i,1)
-                    date_xml += ['<dayy number="%d" name="%s" cell="%d"/>' % (x, som1.replace(day=x).strftime('%a'),cell+x) for x in range(1, lengthmonth(years,i)+1)]
+                    date_xml += ['<dayy number="%d" name="%s" cell="%d"/>' % (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,7 +186,7 @@
                     i=i+1
                     j=j+1
                     month_dict[j]=som1.strftime('%B')
-                    date_xml += ['<dayy number="%d" name="%s" cell="%d"/>' % (x, som1.replace(day=x).strftime('%a'),cell+x) for x in range(1, eom.day+1)]
+                    date_xml += ['<dayy number="%d" name="%s" cell="%d"/>' % (x, _(som1.replace(day=x).strftime('%a')),cell+x) for x in range(1, eom.day+1)]
                     cell=cell+x
                     width_dict[j]=x
 
@@ -200,16 +200,16 @@
             st+=',' + str(0.4 *width_dict[m])+'cm'
         st+=',0.4cm</cols_months>\n'
 
-        months_xml =['<months  number="%d" name="%s" />' % (x,month_dict[x]) for x in range(1,len(month_dict)+1) ]
+        months_xml =['<months  number="%d" name="%s"/>' % (x, _(month_dict[x])) for x in range(1,len(month_dict)+1) ]
         months_xml.append(st)
-
+        
         emp_xml=''
         row_id=1
-
+        
         if data['model']=='hr.employee':
             for id in data['form']['emp']:
                  items = obj_emp.read(cr, uid, id, ['id','name'])
-
+                 
                  emp_xml += emp_create_xml(self, cr, uid, 0, holiday_type, row_id, items['id'], items['name'], som, eom)
                  row_id = row_id +1
 
@@ -229,7 +229,7 @@
                     dept_done=1
                     emp_xml += emp_create_xml(self, cr, uid, 0, holiday_type, row_id, item['id'], item['name'], som, eom)
                     row_id = row_id +1
-
+                    
         header_xml = '''
         <header>
         <date>%s</date>

_______________________________________________
Mailing list: https://launchpad.net/~openerp-dev-gtk
Post to     : [email protected]
Unsubscribe : https://launchpad.net/~openerp-dev-gtk
More help   : https://help.launchpad.net/ListHelp

Reply via email to