← Back to team overview

c2c-oerpscenario team mailing list archive

[Bug 680321] Re: UnicodeDecodeError when printing reports v5.0.15

 

*** This bug is a duplicate of bug 537449 ***
    https://bugs.launchpad.net/bugs/537449

** This bug has been marked a duplicate of bug 537449
   Report Fails to handle accented chars
 * You can subscribe to bug 537449 by following this link: https://bugs.launchpad.net/openobject-server/+bug/537449/+subscribe

-- 
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: Won't Fix

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.





References