Merge lp:~therp-nl/ocb-server/6.1_lp1425545_enhanced_flowable_linebreak into lp:ocb-server/6.1

Proposed by Ronald Portier (Therp) on 2015-02-25
Status: Needs review
Proposed branch: lp:~therp-nl/ocb-server/6.1_lp1425545_enhanced_flowable_linebreak
Merge into: lp:ocb-server/6.1
Diff against target: 35 lines (+6/-12)
1 file modified
openerp/report/render/rml2pdf/trml2pdf.py (+6/-12)
To merge this branch: bzr merge lp:~therp-nl/ocb-server/6.1_lp1425545_enhanced_flowable_linebreak
Reviewer Review Type Date Requested Status
Stefan Rijnhart (Opener) 2015-02-25 Needs Information on 2015-04-23
Review via email: mp+250950@code.launchpad.net

Description of the change

Backport report rendering improvement from 7.0

To post a comment you must log in.

This change looks like a proper backport of the upstream change in https://github.com/OCA/OCB/commit/25f5329deb4068ac737bf7ffdfe54046a46221da + https://github.com/OCA/OCB/commit/c62a75a5f3eb08f5fefe69706858a438361cb73d, except that it undoes the OCB-specific change in http://bazaar.launchpad.net/~ocb/ocb-server/6.1/revision/4324. Is this intentional, i.e. is the fix from rev. 4324 included in the upstream change?

review: Needs Information

Unmerged revisions

4332. By Ronald Portier (Therp) on 2015-02-25

[FIX] Backport odoo/oca 7.0 rendering fix.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'openerp/report/render/rml2pdf/trml2pdf.py'
2--- openerp/report/render/rml2pdf/trml2pdf.py 2013-09-10 14:15:41 +0000
3+++ openerp/report/render/rml2pdf/trml2pdf.py 2015-02-25 16:10:22 +0000
4@@ -32,6 +32,7 @@
5 import logging
6 from lxml import etree
7 import base64
8+from distutils.version import LooseVersion
9 from reportlab.platypus.doctemplate import ActionFlowable
10 from openerp.tools.safe_eval import safe_eval as eval
11 from reportlab.lib.units import inch,cm,mm
12@@ -741,18 +742,11 @@
13 style = self.styles.para_style_get(node)
14 if extra_style:
15 style.__dict__.update(extra_style)
16- result = []
17- textuals = self._textual(node).split('\n')
18- keep_empty_lines = (len(textuals) > 1) and len(node.text.strip())
19- for i in textuals:
20- if keep_empty_lines and len(i.strip()) == 0:
21- i = '<font color="white">&nbsp;</font>'
22- result.append(
23- platypus.Paragraph(
24- i, style, **(
25- utils.attr_get(node, [], {'bulletText':'str'}))
26- )
27- )
28+ text_node = self._textual(node).strip().replace('\n\n', '\n').replace('\n', '<br/>')
29+ instance = platypus.Paragraph(text_node, style, **(utils.attr_get(node, [], {'bulletText':'str'})))
30+ result = [instance]
31+ if LooseVersion(reportlab.Version) > LooseVersion('3.0') and not instance.getPlainText().strip() and instance.text.strip():
32+ result.append(platypus.Paragraph('&nbsp;<br/>', style, **(utils.attr_get(node, [], {'bulletText': 'str'}))))
33 return result
34 elif node.tag=='barCode':
35 try:

Subscribers

People subscribed via source and target branches

to status/vote changes: