[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
This commit is contained in:
Alberto Luengo Cabanillas (Pexego) 2011-01-13 17:19:09 +05:30 committed by mtr
parent 257811be7c
commit 0d842d2fa2
2 changed files with 8 additions and 0 deletions

View File

@ -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)

View File

@ -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