Odoo 中文社区

    • 注册
    • 登录
    • 搜索
    • 版块
    • 标签
    • 热门
    • 用户
    • 群组

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

    由于系统升迁的原因,本论坛部分较早期的内容存在格式和链接损坏失效的问题,并非本论坛系统本身的缺陷,望谅解

    本社区没有维护任何QQ群讨论组,任何与本社区同名的QQ群讨论组的言论与本社区无关!

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

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

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

    Odoo 新手求助
    4
    6
    5054
    正在加载更多帖子
    • 从旧到新
    • 从新到旧
    • 最多赞同
    回复
    • 在新帖中回复
    登录后回复
    此主题已被删除。只有拥有主题管理权限的用户可以查看。
    • Joshua
      Joshua 管理员 最后由 编辑

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

      【上海先安科技】(joshua AT openerp.cn),欢迎关注公众号:openerp_cn

      1 条回复 最后回复 回复 引用 0
      • C
        codefans 最后由 编辑

        我也有这样的需求了。。

        1 条回复 最后回复 回复 引用 0
        • Y
          youring 最后由 编辑

          问过类似的 http://help.openerp.com/question/18208/how-to-set-different-headerfooter-for-quotationsopoinvoiceetc/ 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]

          一直没测试...
          应该有直接在rml里指定header和footer的tag?

          1 条回复 最后回复 回复 引用 0
          • Joshua
            Joshua 管理员 最后由 编辑

            可以的,首先要取消系统的页眉页脚,

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



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

            <br />&lt;document filename=&quot;Sales Order.pdf&quot;&gt;<br />&nbsp; &lt;template title=&quot;Sales Order&quot; author=&quot;OpenERP S.A.([email protected])&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 />
            

            【上海先安科技】(joshua AT openerp.cn),欢迎关注公众号:openerp_cn

            1 条回复 最后回复 回复 引用 0
            • Q
              qq342406169 最后由 编辑

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

              1 条回复 最后回复 回复 引用 0
              • First post
                Last post