Dears,
we have the request to print the user defined corporate header only on the first page of a business document on PDF (such as invoice, sales quotation, sales order). All other pages of the PDF reports must just contain our corporate logo.
Lucky to find the post of Brett Lehrer I tried to achieve this using
<header>
<pageTemplate>
<frame id="first" x1="1.3cm" y1="3.0cm" height="21.7cm" width="19.0cm"/>
<stylesheet>
<!-- style definitions in here -->
</stylesheet>
<pageGraphics>
...
<!-- corporate logo definition in here -->
...
<docIf cond="doc.page==1">
...
<!-- all corporate contact data in here -->
...
</docIf>
</pageGraphics>
</pageTemplate>
</header>
in the custom corporate header RML definition.
Further modified the file ./odoo/openerp/report/render/rml2pdf/trml2pdf.py in function def _flowable(...) to handle a <docIf> tag as follows
elif node.tag == 'hr':
width_hr=node.get('width') or '100%'
color_hr=node.get('color') or 'black'
thickness_hr=node.get('thickness') or 1
lineCap_hr=node.get('lineCap') or 'round'
return platypus.flowables.HRFlowable(width=width_hr,color=color.get(color_hr),thickness=float(thickness_hr),lineCap=str(lineCap_hr))
##### edit-start ####
elif node.tag == 'docIf':
return platypus.flowables.DocIf(node.get('cond'), self.render(node))
##### edit-end ####
else:
sys.stderr.write('Warning: flowable not yet implemented: %s !\n' % (node.tag,))
return None
But this brought not the required result:
The corporate header prints on PDF without any of the definitions inside the <docIf> tags on every page. It seems as if the condition never becomes True.
Web research for days now brought no result.
Anyone of you might already solved such demand or played with conditional RML output in OpenERP/odoo?
Can you help, please? Your comments/ideas are highly appreciated. Thanks