openerp - RML Test of Page Number -
moin moin, i'm working on openerp 7 , there pdf's created rml. problem is: need page numbers, starting of second page. tried rml if clause statements, page 1 gets printed time , things printet pretty wierd.
<header> <pagetemplate id="second"> <frame id="second" x1="2.2cm" y1="2.5cm" width="16.9cm" height="22.3cm"/> <pagegraphics> <image file="images/isatech_water_header_medium.jpg" x="0.0cm" y="24.4cm" width="19.0cm" height="6.0cm"/> <image file="images/isatech_water_footer.jpg" x="0.0cm" y="-0.5cm" width="16.9cm" height="2.6cm"/> </pagegraphics> </pagetemplate> <pagetemplate id="first"> <frame id="first" x1="2.2cm" y1="2.5cm" width="16.9cm" height="22.3cm"/> <pagegraphics> <image file="images/isatech_water_header.jpg" x="0.0cm" y="24.4cm" width="19.0cm" height="6.0cm"/> <image file="images/isatech_water_footer.jpg" x="0.0cm" y="-0.5cm" width="16.9cm" height="2.6cm"/> [[ <pagenumber/> != '1' , <drawcentredstring x="10cm" y="0.3cm"><pagenumber/></drawcentredstring> ]] </pagegraphics> </pagetemplate> </header>
what gets printed on pdf is:
]] 1(2,3,...)
the pagetemplate second printing different header after page 1. hope straigt after page numbers.
i have no idea why code behaves does. different solutions welcome.
mfg chris
i found different way it. not idea check pagenumber in rml. if got right, pagenumber processed 1 of last steps. (same goes pagecount makes sense can't know pagecount until end of building document) if call python function pagenumber gets handled string. can imagine same reason. helped myself <setnexttemplate name="pagetemplate id"/>
- uncheck add rml header in settings > actions > reports > "your report"
change rml file , define different pagetemplates
<template title="sales order" author="openerp s.a.(sales@openerp.com)" allowsplitting="20" showboundary="0"> <pagetemplate id="first"> <frame id="first" x1="2.2cm" y1="2.5cm" width="16.9cm" height="22.3cm"/> <pagegraphics> <image file="images/header_page_1.jpg" x="0.8cm" y="24.7cm" width="16,9cm" height="4cm"/> <image file="images/footer_page_1.jpg" x="0.4cm" y="-0.4cm" width="16.9cm" height="2.3cm"/> </pagegraphics> </pagetemplate> <pagetemplate id="second"> <frame id="first" x1="2.2cm" y1="2.5cm" width="16.9cm" height="22.3cm"/> <pagegraphics> <image file="images/header_page_2.jpg" x="0.8cm" y="24.7cm" width="16,9cm" height="4cm"/> <image file="images/header_page_2.jpg" x="0.4cm" y="-0.4cm" width="16.9cm" height="2.3cm"/> </pagegraphics> </pagetemplate>
somewhere on page x add
<setnexttemplate name="pagetemplate id"/>
or<setnexttemplate name="pagetemplate id"/> <nextframe/>
change pagetemplate of page x+1
<setnexttemplate name="pagetemplate id"/>
defines pagetemplate of next page , <nextframe/>
additionaly end current page.
edit(multi-company-header): kind of forgot have multi company headers. still use method. copy .rml every company , hardcode different company logos. in reports setting page every company(database) specific right .rml file. i's redundant, didn't found better solution.
vg chris
Comments
Post a Comment