How to display RML custom header and footer in all page - openerp-7

I add my own custom header and footer in RML report, the problem is when I select all the record and print, first page prints correctly, the problem occurs in second page, header and report data overlapped, so how to set header in all the pages without overlapping
<template title="High_Value_Item" author="OpenERP S.A.(sales#openerp.com)" allowSplitting="20">
<pageTemplate id="first">
<frame id="first" x1="30.0" y1="27.0" width="508" height="815"/>
<pageGraphics>
<image x="1.3cm" y="26.0cm" height="90.0">[[company.logo or removeParentNode('image')]]</image>
<place x="16.6cm" y="25.3cm" height="1.8cm" width="15.0cm">
<para fontSize="7.0" fontName="Helvetica" >[[ display_address(company.partner_id) or '' ]]</para>
</place>
<lines>1.3cm 24.9cm 19.9cm 24.9cm</lines>
</pageGraphics>
</pageTemplate>
The above code from my RML report

try this,
<template title="High_Value_Item" author="OpenERP S.A.(sales#openerp.com)" allowSplitting="20">
<pageTemplate id="first">
<frame id="first" x1="8.7cm" y1="5.0cm" height="24.0cm" width="21.5cm"/>
<pageGraphics>
<image x="1.3cm" y="26.0cm" height="90.0">[[company.logo or removeParentNode('image')]]</image>
<place x="16.6cm" y="25.3cm" height="1.8cm" width="15.0cm">
<para fontSize="7.0" fontName="Helvetica" >[[ display_address(company.partner_id) or '' ]]</para>
</place>
<lines>1.3cm 24.9cm 19.9cm 24.9cm</lines>
</pageGraphics>
</pageTemplate>
I coded in air so if any content comes in undesired place than you may change the x and y coordinate.
Hope this will help you.

Related

RML Test of Page Number

Moin Moin,
I'm working on Openerp 7 and there pdf's get created with rml.
Problem is: I need Page Numbers, but just starting of the second Page.
I tried some rml if clause statements, but Page 1 gets printed all the time and the things that get printet are 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' and <drawCentredString x="10cm" y="0.3cm"><pageNumber/></drawCentredString> ]]
</pageGraphics>
</pageTemplate>
</header>
What gets printed on the pdf is:
]] 1(2,3,...)
The pageTemplate second is for printing different header after page 1. I hope to get that straigt after the page numbers.
I really have no idea why the code behaves like he does. Different solutions are also welcome.
mfg Chris
I found a different way to do it.
It is not a good Idea to check the pageNumber in RML.
If I got it right, then the pageNumber is processed as one of the last steps. (Same goes for PageCount where it makes sense as you can't know the pageCount until the end of building your document)
Even if you call a python function with a pageNumber it gets handled as a String. I can just imagine it is the same reason.
I helped myself with a <setNextTemplate name="pageTemplate id"/>
Uncheck Add RML header in Settings > Actions > Reports > "Your Report"
Change your RML File and define the 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/> to change the pageTemplate of page x+1
<setNextTemplate name="pageTemplate id"/> simply defines the pageTemplate of the next page and
<nextFrame/> additionaly end the current page.
Edit(Multi-Company-Header): I kind of forgot that we have multi Company Headers. Still I use this method. I just copy the .rml for every Company and hardcode the different company logos. Then in the reports setting page for every company(database) I specific the right .rml file.
I's very redundant, but I didn't found a better solution.
VG Chris

want to display information with link to marker on map using gmaps4jsf

I am using gmaps4jsf jar file and getting dynamic marker on google map. marker having some information and once i click on marker then get the popup and i wrote there "Click me!" i want to provide link on marker data
jsf code:
<m:map id="map" width="650px" height="450px" latitude="#{map.latitude}" longitude="#{map.longitude}" enableScrollWheelZoom="true" zoom="9">
<m:marker latitude="#{point2.latitude}" longitude="#{point2.longitude}" >
<m:htmlInformationWindow htmlText="Click me!" />
</m:marker>
</m:map>
<p:column>
<p:commandButton value="Display" action="#{map.display}" update="form"/>
</p:column>
you want to write somthing like this,
<m:htmlInformationWindow htmlText="Click <a href='info.xhtml' target='_blank'>me!</a>" />
target='_blank' means you link will be open in new tab if you want to open same tab then you can remove the target.
but in jsf you can't acheive symbol without & operater so you need to like this where < means "<" and &gt means ">"
<m:htmlInformationWindow htmlText="Click <a href='info.xhtml' target='_blank'>me!</a>" />

Adding footer in an RML document

I have a document in which I already managed to insert a header. The body starts after the header and continues on to next pages where my header is there.
That said, I am not able to properly add a footer. From checking the RML reference there seems to be no tag I can add that will act as a footer so I have to come up with a solution. So far nothing I have tried works. Here is my template section:
<template pageSize="(595.0,842.0)" title="Test" author="geof" allowSplitting="20">
<pageTemplate id="first">
<frame id="first" x1="24.0" y1="-80.0" width="530" height="796"/>
<header>
<pageGraphics>
<image x="5.3cm" y="8.9cm" height="280.0">[[ get_background() ]]</image>
<image x="6.3cm" y="25.7cm" height="80.0" >[[ company.logo or removeParentNode('image') ]]</image>
<!-- <drawString x="1.0cm" y="28.1cm">[[ company.name ]]</drawString>
<drawRightString x="20cm" y="28.1cm"> Reference Guide </drawRightString>
<lines>1cm 28cm 20cm 28cm</lines> -->
<drawString x="7.0cm" y="1.1cm" height="50.0">[[ get_footer() ]]</drawString>
</pageGraphics>
</header>
</pageTemplate>
</template>
"-Go to "Settings" -Choose "Company"; select your company
You can customize the footer on the bottem field on the initial screen
-Choose the "Footer/header-text" tab
You can edit the header (and footer) text here; you can view your changes by using the preview button on the top right hand corner of this screen."
UPDATE:
----------
how to add a user defined header in a rml report in openerp?

ModX Eform: Captcha not generating image

I am trying to get CAPTCHA working on the eForm plugin. I have added the input form field:
<label for="cfCaptcha">Captcha:<br />
<img src="[+verimageurl+]" alt="verification code"><br />
<input id="vericode" name="vericode" class="text" type="text">
and I have added
&vericode=`1`
to the eForm call.
and have added the Template Variable [+verimageurl+] to my template.
However, when I preview the form all I see in the image area is <img src="" alt="verification code">
Would anyone know what I am doing wrong?
Did you get this fixed?
Check that you ended the label code. Run it through w3c code checker too.
A few times I have left a element un-closed and it breaks the whole thing.

Flex - returning a window to its original state

I have been tearing my hair out now for a week or so, it's time I sought some help...
I am coding a small app to show me the next train leaving the station. Normally only the hour of the next train is shown, but if you click on the prefs button, the application window enlarges and a datagrid is shown with the trains and hours. Clicking on the close button in that state returns you to the 'start' state, or should do so.
The problem is that the datagrid disappears, but the application window stays the same size. It should return to it's original size.
I've been trying lots of different approaches, replacing VBoxes by Canvas or Panels but none worked. In design mode everything work as expected when switching between states.
This is the first time I've been using states, so I might be missing something fundamental.
Here's a code sample - I'm using 2 view states, Start and Prefs.
<mx:WindowedApplication xmlns:mx="http://www.adobe.com/2006/mxml"
creationComplete="init();"
cornerRadius="12"
currentState='Start' width="350" height="250">
<mx:states>
<mx:State name="Start">
<mx:AddChild>
<mx:VBox id="box_parent" width="100%" height="100%" verticalGap="2">
<mx:Label text="Next Train Leaves At" textAlign="center" width="100%"/>
<mx:Label text="--:--" width="100%" height="100" fontSize="64" id="timetext" textAlign="center" fontWeight="bold"/>
<mx:HBox width="100%" height="25" id="hbox1">
<mx:Button label="Prefs"
id="buttonPrefs"
click="currentState='Prefs'"/>
<mx:Spacer width="70%" id="spacer1"/>
<mx:Button
label="Next"
click="findNextTrain()" id="buttonNext"/>
</mx:HBox>
</mx:VBox>
</mx:AddChild>
<mx:SetProperty name="layout" value="vertical"/>
<mx:SetProperty name="width" value="350"/>
<mx:SetProperty name="height" value="220"/>
</mx:State>
<mx:State name="Prefs" basedOn="Start">
<mx:AddChild relativeTo="{box_parent}" position="lastChild">
<mx:DataGrid height="80%" width="100%" dataProvider="{trains}" id="traindata" editable="false">
<mx:columns>
<mx:DataGridColumn headerText="Station" dataField="stationid"/>
<mx:DataGridColumn headerText="Leave" dataField="leave"/>
</mx:columns>
</mx:DataGrid>
</mx:AddChild>
<mx:RemoveChild target="{buttonPrefs}"/>
<mx:SetProperty target="{box_parent}" name="height" value="500"/>
<mx:AddChild relativeTo="{spacer1}" position="before">
<mx:Button label="Close" click="currentState='Start'"/>
</mx:AddChild>
<mx:SetProperty name="height" value="570"/>
</mx:State>
</mx:states>
<mx:transitions>
<mx:Transition fromState="*" toState="*">
<mx:Resize target="{this}" duration="500"/>
</mx:Transition>
</mx:transitions>
</mx:WindowedApplication>
I have yet to find a way to reset a state in Flex to the values provided in the MXML. You have to reset what values you need your self programmatically. In the case of the provided sample code, you can reset the height of the application when changing back to the start state by adding the following into the WindowedApplication tag
currentStateChange="if(currentState == 'Start') this.height = 220"
This tells the WindowedApplication tag to handle the event dispatched after changing the current state to check if the new current state is Start, and to set the window height if it is.