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
=== modified file 'bin/report/render/rml2pdf/trml2pdf.py'
--- bin/report/render/rml2pdf/trml2pdf.py 2011-05-04 09:50:00 +0000
+++ bin/report/render/rml2pdf/trml2pdf.py 2011-10-03 06:26:19 +0000
@@ -118,7 +118,7 @@
118 def draw(self):118 def draw(self):
119 self.canv.beginForm("pageCount")119 self.canv.beginForm("pageCount")
120 self.canv.setFont("Helvetica", utils.unit_get(str(8)))120 self.canv.setFont("Helvetica", utils.unit_get(str(8)))
121 self.canv.drawString(0, 0, str(self.canv.getPageNumber()))121 self.canv.drawString(0, 0, str(self.canv._pageCount))
122 self.canv.endForm()122 self.canv.endForm()
123123
124class PageReset(platypus.Flowable):124class PageReset(platypus.Flowable):
125125
=== modified file 'bin/report/report_sxw.py'
--- bin/report/report_sxw.py 2011-06-27 10:25:37 +0000
+++ bin/report/report_sxw.py 2011-10-03 06:26:19 +0000
@@ -434,9 +434,9 @@
434 context={}434 context={}
435 pool = pooler.get_pool(cr.dbname)435 pool = pooler.get_pool(cr.dbname)
436 attach = report_xml.attachment436 attach = report_xml.attachment
437 results = []
437 if attach:438 if attach:
438 objs = self.getObjects(cr, uid, ids, context)439 objs = self.getObjects(cr, uid, ids, context)
439 results = []
440 for obj in objs:440 for obj in objs:
441 aname = eval(attach, {'object':obj, 'time':time})441 aname = eval(attach, {'object':obj, 'time':time})
442 result = False442 result = False
@@ -467,18 +467,24 @@
467 #TODO: should probably raise a proper osv_except instead, shouldn't we? see LP bug #325632467 #TODO: should probably raise a proper osv_except instead, shouldn't we? see LP bug #325632
468 logging.getLogger('report').error('Could not create saved report attachment', exc_info=True)468 logging.getLogger('report').error('Could not create saved report attachment', exc_info=True)
469 results.append(result)469 results.append(result)
470 if results:470 else:
471 if results[0][1]=='pdf':471 for id in ids:
472 from pyPdf import PdfFileWriter, PdfFileReader472 result = self.create_single_pdf(cr, uid, [id], data, report_xml, context)
473 output = PdfFileWriter()473 if not result:
474 for r in results:474 return False
475 reader = PdfFileReader(cStringIO.StringIO(r[0]))475 results.append(result)
476 for page in range(reader.getNumPages()):476 if results:
477 output.addPage(reader.getPage(page))477 if results[0][1] == 'pdf':
478 s = cStringIO.StringIO()478 from pyPdf import PdfFileWriter, PdfFileReader
479 output.write(s)479 output = PdfFileWriter()
480 return s.getvalue(), results[0][1]480 for r in results:
481 return self.create_single_pdf(cr, uid, ids, data, report_xml, context)481 reader = PdfFileReader(cStringIO.StringIO(r[0]))
482 for page in range(reader.getNumPages()):
483 output.addPage(reader.getPage(page))
484 s = cStringIO.StringIO()
485 output.write(s)
486 return s.getvalue(), results[0][1]
487 return False
482488
483 def create_single_pdf(self, cr, uid, ids, data, report_xml, context=None):489 def create_single_pdf(self, cr, uid, ids, data, report_xml, context=None):
484 if not context:490 if not context: