[FIX] rml: avoid reports ending by zero (opw 608073)
authorMartin Trigaux <mat@openerp.com>
Tue, 1 Jul 2014 09:29:22 +0000 (11:29 +0200)
committerMartin Trigaux <mat@openerp.com>
Tue, 1 Jul 2014 09:29:22 +0000 (11:29 +0200)
Commit b6a7402 (reverted at f8671cb) was almost correct, the PageReset should be added at the end of each stories but only if we have one more stories.
The PageReset will force the page count to be reseted at zero which means that last page of report would have been at zero.

openerp/report/render/rml2pdf/trml2pdf.py

index 70965d2..9ed1a14 100644 (file)
@@ -999,10 +999,10 @@ class _rml_template(object):
         story_cnt = 0
         for node_story in node_stories:
             if story_cnt > 0:
+                # Reset Page Number with new story tag
+                fis.append(PageReset())
                 fis.append(platypus.PageBreak())
             fis += r.render(node_story)
-            # Reset Page Number with new story tag
-            fis.append(PageReset())
             story_cnt += 1
         try:
             if self.localcontext and self.localcontext.get('internal_header',False):