跳转至内容
  • 版块
  • 标签
  • 热门
  • 用户
  • 群组
皮肤
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • 默认(Flatly)
  • 不使用皮肤
折叠

Odoo 中文社区

  1. 主页
  2. 版块
  3. Odoo 新手求助
  4. [报表开发]如何手动在rml报表里添加页眉页脚

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

已定时 已固定 已锁定 已移动 Odoo 新手求助
6 帖子 4 发布者 5.3k 浏览
  • 从旧到新
  • 从新到旧
  • 最多赞同
登录后回复
此主题已被删除。只有拥有主题管理权限的用户可以查看。
  • JoshuaJ 离线
    JoshuaJ 离线
    Joshua 管理员
    写于 最后由 编辑
    #1

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

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

    1 条回复 最后回复
    0
    • C 离线
      C 离线
      codefans
      写于 最后由 编辑
      #2

      我也有这样的需求了。。

      1 条回复 最后回复
      0
      • Y 离线
        Y 离线
        youring
        写于 最后由 编辑
        #3

        问过类似的 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
        • JoshuaJ 离线
          JoshuaJ 离线
          Joshua 管理员
          写于 最后由 编辑
          #4

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

          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 离线
            Q 离线
            qq342406169
            写于 最后由 编辑
            #5

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

            1 条回复 最后回复
            0

            • 登录

            • 没有帐号? 注册

            • 登录或注册以进行搜索。
            • 第一个帖子
              最后一个帖子
            0
            • 版块
            • 标签
            • 热门
            • 用户
            • 群组