Merge lp:~openerp-dev/openobject-server/6.0-opw-17683-rgo into lp:openobject-server/6.0

Proposed by Ravi Gohil (OpenERP)
Status: Superseded
Proposed branch: lp:~openerp-dev/openobject-server/6.0-opw-17683-rgo
Merge into: lp:openobject-server/6.0
Diff against target: 64 lines (+20/-14)
2 files modified
bin/report/render/rml2pdf/trml2pdf.py (+1/-1)
bin/report/report_sxw.py (+19/-13)
To merge this branch: bzr merge lp:~openerp-dev/openobject-server/6.0-opw-17683-rgo
Reviewer Review Type Date Requested Status
Raphael Collet (OpenERP) (community) Needs Fixing
Review via email: mp+77108@code.launchpad.net

This proposal has been superseded by a proposal from 2011-10-03.

Description of the change

Hello,

There was as issue with pageCount tag in .rml files, pageCount tag returns 0.

This fixes the issue. The solution has been back-ported from Trunk.

Thanks.

To post a comment you must log in.
Revision history for this message
Raphael Collet (OpenERP) (rco-openerp) wrote :

There is no else case in the two last nested 'if' statements.
- Can 'results' be empty? What should we return in that case?
- What should the method do if not results[0][1] == 'pdf' ?

Otherwise it looks okay.

review: Needs Fixing
3500. By Launchpad Translations on behalf of openerp

Launchpad automatic translations update.

3501. By Launchpad Translations on behalf of openerp

Launchpad automatic translations update.

3502. By Launchpad Translations on behalf of openerp

Launchpad automatic translations update.

3503. By Jay Vora (Serpent Consulting Services)

[FIX] call to fields_get should always go with context attached

3504. By Jay Vora (Serpent Consulting Services)

[MERGE] Merged Rifakat's branch for the fix of domain and context over Accounting/Customers/Customers menu

3505. By Raphael Collet (OpenERP)

[MERGE] opw 17657

3506. By Launchpad Translations on behalf of openerp

Launchpad automatic translations update.

3507. By Launchpad Translations on behalf of openerp

Launchpad automatic translations update.

3508. By Launchpad Translations on behalf of openerp

Launchpad automatic translations update.

3509. By Ravi Gohil (OpenERP)

[FIX] report: change the code by returning 'False' at the end of method body

Unmerged revisions

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'bin/report/render/rml2pdf/trml2pdf.py'
2--- bin/report/render/rml2pdf/trml2pdf.py 2011-05-04 09:50:00 +0000
3+++ bin/report/render/rml2pdf/trml2pdf.py 2011-10-03 06:26:19 +0000
4@@ -118,7 +118,7 @@
5 def draw(self):
6 self.canv.beginForm("pageCount")
7 self.canv.setFont("Helvetica", utils.unit_get(str(8)))
8- self.canv.drawString(0, 0, str(self.canv.getPageNumber()))
9+ self.canv.drawString(0, 0, str(self.canv._pageCount))
10 self.canv.endForm()
11
12 class PageReset(platypus.Flowable):
13
14=== modified file 'bin/report/report_sxw.py'
15--- bin/report/report_sxw.py 2011-06-27 10:25:37 +0000
16+++ bin/report/report_sxw.py 2011-10-03 06:26:19 +0000
17@@ -434,9 +434,9 @@
18 context={}
19 pool = pooler.get_pool(cr.dbname)
20 attach = report_xml.attachment
21+ results = []
22 if attach:
23 objs = self.getObjects(cr, uid, ids, context)
24- results = []
25 for obj in objs:
26 aname = eval(attach, {'object':obj, 'time':time})
27 result = False
28@@ -467,18 +467,24 @@
29 #TODO: should probably raise a proper osv_except instead, shouldn't we? see LP bug #325632
30 logging.getLogger('report').error('Could not create saved report attachment', exc_info=True)
31 results.append(result)
32- if results:
33- if results[0][1]=='pdf':
34- from pyPdf import PdfFileWriter, PdfFileReader
35- output = PdfFileWriter()
36- for r in results:
37- reader = PdfFileReader(cStringIO.StringIO(r[0]))
38- for page in range(reader.getNumPages()):
39- output.addPage(reader.getPage(page))
40- s = cStringIO.StringIO()
41- output.write(s)
42- return s.getvalue(), results[0][1]
43- return self.create_single_pdf(cr, uid, ids, data, report_xml, context)
44+ else:
45+ for id in ids:
46+ result = self.create_single_pdf(cr, uid, [id], data, report_xml, context)
47+ if not result:
48+ return False
49+ results.append(result)
50+ if results:
51+ if results[0][1] == 'pdf':
52+ from pyPdf import PdfFileWriter, PdfFileReader
53+ output = PdfFileWriter()
54+ for r in results:
55+ reader = PdfFileReader(cStringIO.StringIO(r[0]))
56+ for page in range(reader.getNumPages()):
57+ output.addPage(reader.getPage(page))
58+ s = cStringIO.StringIO()
59+ output.write(s)
60+ return s.getvalue(), results[0][1]
61+ return False
62
63 def create_single_pdf(self, cr, uid, ids, data, report_xml, context=None):
64 if not context: