← Back to team overview

c2c-oerpscenario team mailing list archive

[Bug 680321] [NEW] UnicodeDecodeError when printing reports v5.0.15

 

Public bug reported:


After migrating from version 5.0.11 to 5.0.15, we are having trouble sometimes with reports generation. Printing a sales quotation or a picking delivery note always gives the error below :

File "openerp-server-5.0.15/bin/report/report_sxw.py", line 292, in _translate
[2010-11-22 12:56:23,177][DB] ERROR:web-services:[59]:     piece_list[pn] = piece_list[pn].replace(source_string, translated_string)
[2010-11-22 12:56:23,177][DB] ERROR:web-services:[60]: UnicodeDecodeError: 'ascii' codec can't decode byte 0xd8 in position 0: ordinal not in range(128)

Thinking that it was a database Unicode problem, we backup up the
database, dropped it, changed encoding and restored, problem not solved.

Encoding for the database is UTF8 by the way.

We have 2 languages installed, English and Arabic. Arabic is almost
never used. We fiddled with the setting for languages but problem wasn't
resolved. Reverting back to 5.0.11 produced no error whatsoever.

Finally, we came with this work around, it's not a solution, but a work
around, as it disables translation in reports :

First delete the file openerp-server-5.0.15/bin/report/report_sxw.pyc

Then open openerp-server-5.0.15/bin/report/report_sxw.py for editing,
and replace lines 281-294 by the following :

def _translate(self,text):
       # lang = self.localcontext['lang']
       # if lang and text and not text.isspace():
       #     transl_obj = self.pool.get('ir.translation')
       #     piece_list = self._transl_regex.split(text)
       #     for pn in range(len(piece_list)):
       #         if not self._transl_regex.match(piece_list[pn]):
       #             source_string = piece_list[pn].replace('\n', ' ').strip()
       #             if len(source_string):
       #                 translated_string = transl_obj._get_source(self.cr, self.uid, self.name, 'rml', lang, source_string)
       #                 if translated_string:
       #                     piece_list[pn] = piece_list[pn].replace(source_string, translated_string)
       #     text = ''.join(piece_list)
return text


Restart the server afterwards.
This as you can see, disables translation in reports. No side effects noticed till this moment, hope it goes will.
Our server is openSUSE 11.1 Linux 64 bits.

** Affects: openobject-server
     Importance: Undecided
         Status: New

-- 
UnicodeDecodeError when printing reports v5.0.15
https://bugs.launchpad.net/bugs/680321
You received this bug notification because you are a member of C2C
OERPScenario, which is subscribed to the OpenERP Project Group.

Status in OpenObject Server: New

Bug description:

After migrating from version 5.0.11 to 5.0.15, we are having trouble sometimes with reports generation. Printing a sales quotation or a picking delivery note always gives the error below :

File "openerp-server-5.0.15/bin/report/report_sxw.py", line 292, in _translate
[2010-11-22 12:56:23,177][DB] ERROR:web-services:[59]:     piece_list[pn] = piece_list[pn].replace(source_string, translated_string)
[2010-11-22 12:56:23,177][DB] ERROR:web-services:[60]: UnicodeDecodeError: 'ascii' codec can't decode byte 0xd8 in position 0: ordinal not in range(128)

Thinking that it was a database Unicode problem, we backup up the database, dropped it, changed encoding and restored, problem not solved.

Encoding for the database is UTF8 by the way.

We have 2 languages installed, English and Arabic. Arabic is almost never used. We fiddled with the setting for languages but problem wasn't resolved. Reverting back to 5.0.11 produced no error whatsoever.

Finally, we came with this work around, it's not a solution, but a work around, as it disables translation in reports :

First delete the file openerp-server-5.0.15/bin/report/report_sxw.pyc

Then open openerp-server-5.0.15/bin/report/report_sxw.py for editing, and replace lines 281-294 by the following :

def _translate(self,text):
       # lang = self.localcontext['lang']
       # if lang and text and not text.isspace():
       #     transl_obj = self.pool.get('ir.translation')
       #     piece_list = self._transl_regex.split(text)
       #     for pn in range(len(piece_list)):
       #         if not self._transl_regex.match(piece_list[pn]):
       #             source_string = piece_list[pn].replace('\n', ' ').strip()
       #             if len(source_string):
       #                 translated_string = transl_obj._get_source(self.cr, self.uid, self.name, 'rml', lang, source_string)
       #                 if translated_string:
       #                     piece_list[pn] = piece_list[pn].replace(source_string, translated_string)
       #     text = ''.join(piece_list)
return text


Restart the server afterwards.
This as you can see, disables translation in reports. No side effects noticed till this moment, hope it goes will.
Our server is openSUSE 11.1 Linux 64 bits.





Follow ups

References