From 0d842d2fa276e27d3ce4b76e3223f1bc2cae8145 Mon Sep 17 00:00:00 2001 From: "Alberto Luengo Cabanillas (Pexego)" <> Date: Thu, 13 Jan 2011 17:19:09 +0530 Subject: [PATCH] [FIX] hr_timesheet:print reports having employee name/surname with accents lp bug: https://launchpad.net/bugs/695960 fixed bzr revid: mtr@mtr-20110113114909-q19c08vax7dxgy1v --- addons/hr_timesheet/report/user_timesheet.py | 4 ++++ addons/hr_timesheet/report/users_timesheet.py | 4 ++++ 2 files changed, 8 insertions(+) diff --git a/addons/hr_timesheet/report/user_timesheet.py b/addons/hr_timesheet/report/user_timesheet.py index 4d1d5f428cf..ee324fd3f41 100755 --- a/addons/hr_timesheet/report/user_timesheet.py +++ b/addons/hr_timesheet/report/user_timesheet.py @@ -27,6 +27,7 @@ from tools.translate import _ import time import pooler from report import report_sxw +import unicodedata def lengthmonth(year, month): if month == 2 and ((year % 4 == 0) and ((year % 100 != 0) or (year % 400 == 0))): @@ -49,6 +50,9 @@ class report_custom(report_rml): emp_obj = pooler.get_pool(cr.dbname).get('hr.employee') user_id = emp_obj.browse(cr, uid, emp_id).user_id.id empl_name = emp_obj.browse(cr, uid, emp_id).name + if isinstance(empl_name,unicode): + empl_name = (unicodedata.normalize('NFKD', unicode(empl_name)).encode('ASCII', 'ignore')) + # Computing the dates (start of month: som, and end of month: eom) som = datetime.date(data['form']['year'], data['form']['month'], 1) diff --git a/addons/hr_timesheet/report/users_timesheet.py b/addons/hr_timesheet/report/users_timesheet.py index e6b366d627a..2ba1c8f314f 100755 --- a/addons/hr_timesheet/report/users_timesheet.py +++ b/addons/hr_timesheet/report/users_timesheet.py @@ -26,6 +26,7 @@ import time import pooler from tools.translate import _ from report import report_sxw +import unicodedata def lengthmonth(year, month): @@ -91,6 +92,9 @@ class report_custom(report_rml): for id in data['form']['employee_ids']: user = emp_obj.browse(cr, uid, id).user_id.id empl_name = emp_obj.browse(cr, uid, id).name + if isinstance(empl_name,unicode): + empl_name = (unicodedata.normalize('NFKD', unicode(empl_name)).encode('ASCII', 'ignore')) + if user: emp_xml += emp_create_xml(cr, user, som, eom, empl_name) # Computing the xml