Naresh(OpenERP) has proposed merging 
lp:~openerp-dev/openobject-server/trunk-bug-891544-nch into 
lp:openobject-server.

Requested reviews:
  OpenERP R&D Team (openerp-dev)
  Vo Minh Thu (OpenERP) (vmt-openerp)
  Olivier Dony (OpenERP) (odo-openerp)
Related bugs:
  Bug #891544 in OpenERP Server: "Incorect format of report in OpenOffice"
  https://bugs.launchpad.net/openobject-server/+bug/891544

For more details, see:
https://code.launchpad.net/~openerp-dev/openobject-server/trunk-bug-891544-nch/+merge/83570
-- 
https://code.launchpad.net/~openerp-dev/openobject-server/trunk-bug-891544-nch/+merge/83570
Your team OpenERP R&D Team is requested to review the proposed merge of 
lp:~openerp-dev/openobject-server/trunk-bug-891544-nch into 
lp:openobject-server.
=== modified file 'openerp/osv/fields.py'
--- openerp/osv/fields.py	2011-11-18 13:11:04 +0000
+++ openerp/osv/fields.py	2011-11-28 10:12:30 +0000
@@ -1018,7 +1018,7 @@
             if context.get('bin_size', False):
                 # client requests only the size of binary fields
                 result = get_nice_size(value)
-            else:
+            elif not context.get('bin_raw'):
                 result = sanitize_binary_value(value)
 
         if field_type in ("integer","integer_big") and value > xmlrpclib.MAXINT:

=== modified file 'openerp/report/report_sxw.py'
--- openerp/report/report_sxw.py	2011-11-22 08:58:48 +0000
+++ openerp/report/report_sxw.py	2011-11-28 10:12:30 +0000
@@ -391,8 +391,12 @@
         return table_obj.browse(cr, uid, ids, list_class=browse_record_list, context=context, fields_process=_fields_process)
 
     def create(self, cr, uid, ids, data, context=None):
+        if context is None:
+            context = {}
         if self.internal_header:
             context.update({'internal_header':self.internal_header})
+        #we ask osv.fields.sanitize_binary_value() not to encode the binary value"
+        context.update({'bin_raw':True})
         pool = pooler.get_pool(cr.dbname)
         ir_obj = pool.get('ir.actions.report.xml')
         report_xml_ids = ir_obj.search(cr, uid,
@@ -519,12 +523,13 @@
         context = context.copy()
         report_type = report_xml.report_type
         context['parents'] = sxw_parents
-
-        # if binary content was passed as unicode, we must
-        # re-encode it as a 8-bit string using the pass-through
-        # 'latin1' encoding, to restore the original byte values.
-        # See also osv.fields.sanitize_binary_value()
-        binary_report_content = report_xml.report_sxw_content.encode("latin1")
+        binary_report_content = report_xml.report_sxw_content
+        if isinstance(report_xml.report_sxw_content, unicode):
+            # if binary content was passed as unicode, we must
+            # re-encode it as a 8-bit string using the pass-through
+            # 'latin1' encoding, to restore the original byte values.
+            # See also osv.fields.sanitize_binary_value()
+            binary_report_content = report_xml.report_sxw_content.encode("latin1")
 
         sxw_io = StringIO.StringIO(binary_report_content)
         sxw_z = zipfile.ZipFile(sxw_io, mode='r')

_______________________________________________
Mailing list: https://launchpad.net/~openerp-dev-gtk
Post to     : [email protected]
Unsubscribe : https://launchpad.net/~openerp-dev-gtk
More help   : https://help.launchpad.net/ListHelp

Reply via email to