Adding footer in an RML document - odoo

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?

Related

How to pre populate the ImageField inside ImageInput in Edit Form, or the right approach to take

I am working with react-admin and in the functionality.. I need to display the original picture in an ImageField but if i choose to drag and drop a new picture then i need to update that ImageField with the new picture. I can't seem to see any examples of what would seem to be a pretty common use case for Image related Edit functionality..
<ImageInput source="src" label="Product Image" accept="image/*" >
<ImageField source="imageUrl"/>
</ImageInput>
Seems to be similar to this
question
but obviously i am new to this and after some frigging with it, i'm no closer to getting it to go... The behaviour i would have expected i guess was that because imageUrl does exist on the form, that the ImageField above would already be populated with the existing pic when the form opened but it's not because it's inside the .. If anyone could point me in the right direction it would be a big help
I have done it like this:
<ImageInput source="src" label="Billede" accept="image/*" mulitple={false}>
<ImageField source="thumbnail" title="title" />
</ImageInput>
<FormDataConsumer>
{({formData, dispatch, ...rest}) => {
if (!formData.src) {
return (
<div>
<Labeled label="Original image">
<ImageField source="thumbnail" {...rest}/>
</Labeled>
</div>
);
}
}}
</FormDataConsumer>
This will display the original image, as long as no new image is selected.
When a new image is selected, this will be displayed, and the original will be hidden.

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>" />

How to display RML custom header and footer in all page

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.

How to get the total number of pages in RML template?

There is a tag in RML, <pageNumber>, that displays the the current page number.
But how can I get the total number of pages of the generated PDF document?
I would like to add a pagination with something like "Page 1/2", "Page 2/2":
Page <pageNumber /> / <pageCount>
But the <pageCount> tag doesn't exist.
After spending a considerable amount of time, I found this:
At the end of the <story>, add:
<namedString id="lastPage"><pageNumber/></namedString>
To display pagination, use:
Page <pageNumber /> / <getName id="lastPage" default="0" />
I´ve been working in a solution for this case in OpenErp:
<document>
<template>
<pageTemplate>
<stylesheet>
...
<paraStyle name="main_footer" fontSize="7.0" leading="7" alignment="LEFT" spaceBefore="0.0" spaceAfter="0.0"/>
...
</stylesheet>
...
...
<!-- Page Footer -->
<place x="1.5cm" y="0cm" height="1cm" width="19.0cm">
<para style="main_footer">[[ o.name or '']] | Página: <pageNumber/> de </para>
</place>
<drawString x="4.9cm" y="0.74cm"><pageCount/></drawString>
...
Basically, it "draws" the <pageCount> tag at the left of my footer text. The solution from #alartur is more elegant but it does´t work in the OpenErp rmltopdf converter.
We must use Helvetica font at 7px for our footer text because is the default font used in the rmltopdf code for <pageCount>