Monday, May 19, 2014

Add spaces between lines in RML reports OpenERP

In OpenERP, the rml repots generates will omit the white spaces between lines. So in order to maintain the white spaces between lines needs to modify the base code in openerp report module or modify the rml syntax.

Solution 1:

=== modified file 'openerp/report/render/rml2pdf/trml2pdf.py'
--- openerp/report/render/rml2pdf/trml2pdf.py    2012-07-16 07:52:17 +0000
+++ openerp/report/render/rml2pdf/trml2pdf.py    2012-07-19 10:16:33 +0000
@@ -743,6 +743,8 @@
                 style.__dict__.update(extra_style)
             result = []
             for i in self._textual(node).split('\n'):
+                if len(i.strip()) == 0:
+                    i = '<font color="white"> </font>'
                 result.append(platypus.Paragraph(i, style, **(utils.attr_get(node, [], {'bulletText':'str'}))))
             return result
         elif node.tag=='barCode':

Solution 2:

Replace <para></para> with <xpre></xpre> in rml file.

ex:
<xpre style="terp_default_9">[[ format(o.note or '') ]]</xpre>

Labels: , , , , ,


0 comments: Post Yours! Read Comment Policy ▼
PLEASE NOTE:
We have Zero Tolerance to Spam. Chessy Comments and Comments with Links will be deleted immediately upon our review.

 
Twitter Facebook RSS YouTube Google
© 2014 | Distributed and Designed By Jasad Moozhiyan