Odoo中文社区可以通过以下三个域名访问:shine-it.net , odoocn.org,odoo.net.cn

原论坛用户的基本信息和发帖这里都予以保留,请注意:原论坛用户无需重新注册新用户,但是您的密码需要重置

开发人员可以登录gitter讨论组: http://gitter.im/odoo-china/Talk, 需要github账号

如果您登录系统碰到问题,请在微信公众号留言:

[报表开发]如何手动在rml报表里添加页眉页脚


  • 管理员

    因为不想通过company来做统一的报表表头,想通过直接修改RML来实现,大家有没有什么方案提供<br />谢谢。



  • 我也有这样的需求了。。



  • 问过类似的 http://help.openerp.com/question/18208/how-to-set-different-headerfooter-for-quotationsopoinvoiceetc/ br /><br />[quote]you can upgrade report .py file just change header=False after that make header and footer whatever you want directly in rml file design it as you want .[/quote]<br /><br />一直没测试...<br />应该有直接在rml里指定header和footer的tag?


  • 管理员

    可以的,首先要取消系统的页眉页脚,<br /><br />

    report_sxw.report_sxw(...., header=False)
    

    <br /><br />然后在你的RML里面手动添加页眉页脚(下面是系统默认自动合成的RML),我们手动的时候就是把这段补进去再进行定制。<br />

    <br />&lt;document filename=&quot;Sales Order.pdf&quot;&gt;<br />&nbsp; &lt;template title=&quot;Sales Order&quot; author=&quot;OpenERP S.A.(sales@openerp.com)&quot; allowSplitting=&quot;20&quot;&gt;<br />&nbsp;  &lt;!--页眉页脚--&gt;<br />&nbsp; &nbsp; &lt;frame id=&quot;first&quot; x1=&quot;1.3cm&quot; y1=&quot;3.0cm&quot; height=&quot;21.7cm&quot; width=&quot;19.0cm&quot;&gt;<br />&nbsp; &nbsp; &nbsp; &nbsp;  &lt;/frame&gt;<br />&nbsp; &nbsp; &nbsp; &nbsp;  &lt;stylesheet&gt;<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &lt;!-- Set here the default font to use for all &lt;para&gt; tags --&gt;<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &lt;paraStyle name=&quot;Normal&quot; fontName=&quot;DejaVu Sans&quot;&gt;<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &lt;/paraStyle&gt;<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &lt;paraStyle name=&quot;main_footer&quot; fontSize=&quot;8.0&quot; alignment=&quot;CENTER&quot;&gt;<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &lt;/paraStyle&gt;<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &lt;paraStyle name=&quot;main_header&quot; fontSize=&quot;8.0&quot; leading=&quot;10&quot; alignment=&quot;LEFT&quot; spaceBefore=&quot;0.0&quot; spaceAfter=&quot;0.0&quot;&gt;<br />&nbsp; &nbsp; &nbsp; &nbsp;  &lt;/paraStyle&gt;<br />&nbsp; &nbsp; &nbsp; &nbsp;  &lt;/stylesheet&gt;<br />&nbsp; &nbsp; &nbsp; &nbsp; &lt;pageGraphics&gt;<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &lt;!-- Set here the default font to use for all &lt;drawString&gt; tags --&gt;<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &lt;setFont name=&quot;DejaVu Sans&quot; size=&quot;8&quot;&gt;<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &lt;/setFont&gt;<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &lt;!-- You Logo - Change X,Y,Width and Height --&gt;<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &lt;image x=&quot;1.3cm&quot; y=&quot;27.7cm&quot; height=&quot;40.0&quot; rml_except=&quot; company.logo or removeParentNode(&#039;image&#039;) &quot;&gt;[[ company.logo or removeParentNode(&#039;image&#039;) ]]&lt;/image&gt;<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &lt;fill color=&quot;black&quot;&gt;<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &lt;/fill&gt;<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &lt;stroke color=&quot;black&quot;&gt;<br /><br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &lt;/stroke&gt;<br /><br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &lt;!-- page header --&gt;<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &lt;lines&gt;1.3cm 27.7cm 20cm 27.7cm&lt;/lines&gt;<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &lt;drawRightString x=&quot;20cm&quot; y=&quot;27.8cm&quot;&gt;[[ company.rml_header1 ]]&lt;/drawRightString&gt;<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &lt;drawString x=&quot;1.3cm&quot; y=&quot;27.3cm&quot;&gt;[[ company.partner_id.name ]]&lt;/drawString&gt;<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &lt;place x=&quot;1.3cm&quot; y=&quot;25.3cm&quot; height=&quot;1.8cm&quot; width=&quot;15.0cm&quot;&gt;<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &lt;para style=&quot;main_header&quot;&gt;[[ display_address(company.partner_id) or&nbsp; &#039;&#039; ]]&lt;/para&gt;<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &lt;/place&gt;<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &lt;drawString x=&quot;1.3cm&quot; y=&quot;25.0cm&quot;&gt;Phone:&lt;/drawString&gt;<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &lt;drawRightString x=&quot;7cm&quot; y=&quot;25.0cm&quot;&gt;[[ company.partner_id.phone or &#039;&#039; ]]&lt;/drawRightString&gt;<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &lt;drawString x=&quot;1.3cm&quot; y=&quot;24.6cm&quot;&gt;Mail:&lt;/drawString&gt;<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &lt;drawRightString x=&quot;7cm&quot; y=&quot;24.6cm&quot;&gt;[[ company.partner_id.email or &#039;&#039; ]]&lt;/drawRightString&gt;<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &lt;lines&gt;1.3cm 24.5cm 7cm 24.5cm&lt;/lines&gt;<br /><br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &lt;!-- left margin --&gt;<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &lt;rotate degrees=&quot;90&quot;&gt;<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &lt;/rotate&gt;<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &lt;fill color=&quot;grey&quot;&gt;<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &lt;/fill&gt;<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &lt;drawString x=&quot;2.65cm&quot; y=&quot;-0.4cm&quot;&gt;generated by OpenERP.com&lt;/drawString&gt;<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &lt;fill color=&quot;black&quot;&gt;<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &lt;/fill&gt;<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &lt;rotate degrees=&quot;-90&quot;&gt;<br /><br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &lt;/rotate&gt;<br /><br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &lt;!--page bottom--&gt;<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &lt;lines&gt;1.2cm 2.65cm 19.9cm 2.65cm&lt;/lines&gt;<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &lt;place x=&quot;1.3cm&quot; y=&quot;0cm&quot; height=&quot;2.55cm&quot; width=&quot;19.0cm&quot;&gt;<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &lt;para style=&quot;main_footer&quot;&gt;[[ company.rml_footer ]]&lt;/para&gt;<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &lt;para style=&quot;main_footer&quot;&gt;Contact : [[ user.name ]] - Page: &lt;pageNumber/&gt;&lt;/para&gt;<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &lt;/place&gt;<br />&nbsp; &nbsp; &nbsp; &nbsp; &lt;/pageGraphics&gt;<br /><br />&nbsp; &lt;/template&gt;<br />
    


  • 从其他帖子引流过来的,先mark了,刚开发入门,后续报表开发用得着