Merge lp:~openerp-dev/openobject-addons/7.0-opw-604328-ado into lp:openobject-addons/7.0

Proposed by Amit Dodiya (OpenERP)
Status: Needs review
Proposed branch: lp:~openerp-dev/openobject-addons/7.0-opw-604328-ado
Merge into: lp:openobject-addons/7.0
Diff against target: 20 lines (+2/-2)
1 file modified
hr_holidays/report/holidays_summary_report.py (+2/-2)
To merge this branch: bzr merge lp:~openerp-dev/openobject-addons/7.0-opw-604328-ado
Reviewer Review Type Date Requested Status
Amit Dodiya (OpenERP) (community) Needs Resubmitting
Naresh(OpenERP) (community) Needs Fixing
Review via email: mp+207865@code.launchpad.net

Description of the change

Hello,

[FIX] unicode error holidays report: while we have spanish localisaion set for our operating system and we run the yml tests for hr_holidays it gives the unicode error of date time format

Steps:
1). Set spanish localization in your operating system
2). now run the yml tests for hr_holidays module
It will give you UnicodeDecodeError: 'ascii' codec can't decode byte 0xc3 in position 24: ordinal not in range(12)

Regards,
Amit

To post a comment you must log in.
Revision history for this message
Naresh(OpenERP) (nch-openerp) wrote :

Hello Amit,

The fix is a bit incomplete as the names of month, employee too will have the same fix. Also instead of converting each value every where we can just finally convert each list. Something like this:

@@ -234,7 +234,7 @@
                     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_xml = u'''
         <header>
         <date>%s</date>
         <company>%s</company>
@@ -249,7 +249,10 @@
         %s
         %s
         </report>
- ''' % (header_xml,months_xml,date_xml, ustr(emp_xml))
+ ''' % (header_xml,
+ u''.join((ustr(m) for m in months_xml)),
+ u''.join((ustr(d) for d in date_xml)),
+ u''.join((ustr(e) for e in emp_xml)))

         return xml

Thanks,

review: Needs Fixing
Revision history for this message
Naresh(OpenERP) (nch-openerp) wrote :

same fix ==> Same problem.

Revision history for this message
Amit Dodiya (OpenERP) (ado-openerp) wrote :

Hello,

I have updated the merge proposal according to the comments.

Regards,
Amit

review: Needs Resubmitting

Unmerged revisions

9854. By Amit Dodiya (OpenERP)

[FIX] unicode error holidays report: while we have spanish localisaion set for our operating system and we run the yml tests for hr_holidays it gives the unicode error of date time format

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'hr_holidays/report/holidays_summary_report.py'
2--- hr_holidays/report/holidays_summary_report.py 2013-12-19 13:51:47 +0000
3+++ hr_holidays/report/holidays_summary_report.py 2014-02-24 11:36:53 +0000
4@@ -200,7 +200,7 @@
5
6 date_xml.append('</days>')
7 date_xml.append('<cols>3.5cm%s,0.4cm</cols>\n' % (',0.4cm' * (60)))
8- date_xml = ''.join(date_xml)
9+ date_xml = ''.join(ustr(d) for d in date_xml)
10
11 st='<cols_months>3.5cm'
12 for m in range(1,len(width_dict)+1):
13@@ -252,7 +252,7 @@
14 %s
15 %s
16 </report>
17- ''' % (header_xml,months_xml,date_xml, ustr(emp_xml))
18+ ''' % (header_xml,''.join((ustr(m) for m in months_xml)),date_xml, ustr(emp_xml))
19
20 return xml
21