4

除了公司中定义的页眉/页脚之外,如何为报表(例如交货单中的拣货单报表)添加新的页眉/页脚?

4

4 回答 4

12

在报告标签中放置 header='False',例如。

<report header='False' auto="False" id="report_product_history" 
model="product.product" name="stock.product.history"
 string="Stock Level Forecast"/>

它不会打印公司中定义的默认标题。然后在 rml 文件中找到<pageTemplate>标记,并将其替换为您的 rml 代码。例如。

 <template pageSize="(595.0,842.0)" title="Test" 
        author="Atul Makwana" allowSplitting="20">
        <pageTemplate id="first">
         ***Your rml header & footer***
        </pageTemplate>
 </template>

这样您就可以放置新的页眉和页脚。

于 2012-08-14T08:03:28.447 回答
1

删除标题的一种方法是Atul 建议的,在报告标签中声明它。

<report 
    header="False"
    auto="False" 
    id="report_product_history" 
    model="product.product" 
    name="stock.product.history"
    string="Stock Level Forecast"/>

在某些情况下,没有报告标签。例如,报告可能仅由向导生成。在这种情况下,您可以在注册解析器时将其声明为参数。有关示例,请参见mrp_operations模块的条码报告。

class code_barcode(report_sxw.rml_parse):
    def __init__(self, cr, uid, name, context):
        super(code_barcode, self).__init__(cr, uid, name, context=context)
        self.localcontext.update({
            'time': time,
        })

report_sxw.report_sxw('report.mrp.code.barcode', 
                      'mrp_operations.operation.code', 
                      'addons/mrp_operations/report/mrp_code_barcode.rml',
                      parser=code_barcode,
                      header=False)

您还可以使用该参数指定特定的标头。它默认为'external',但它可以是'internal''internal landscape'使用公司配置中的其他标题之一。

于 2012-10-02T21:51:16.790 回答
1

您可以像这样在您的 report.rml 文件中自定义报告标题,

<pageTemplate id="first">
    <frame id="first" x1="57.0" y1="115.0" width="481" height="615"/>
    <header>
        <pageGraphics>
            <image x="1.3cm" y="26.0cm" height="90.0">[[company.logo or removeParentNode('image')]]</image>
            <drawString x="10.9cm" y="2.9cm">Signature:</drawString>
            <drawString x="12.7cm" y="2.9cm">___________________________________</drawString>
        </pageGraphics>
        </header>
</pageTemplate>
于 2013-09-21T08:49:51.900 回答
1

在报告集标题 = 'False'

现在您可以在页面上添加自己的页眉页脚

<template title="Test" author="Sagar" allowSplitting="20">
    <pageTemplate id="first">
      <frame id="first" x1="15.0" y1="42.0" width="539" height="758"/>
      <pageGraphics>

           <!-- ================== Header =============== -->

            <image x="14cm" y="25.6cm" height="40.0">[[ company.logo or removeParentNode('image') ]]</image>
                <setFont name="Helvetica" size="10.0"/>
                <drawString x="1cm" y="27.2cm">Main Header</drawString>
                <!-- Order Details -->
                <place x="33" y="18cm" width="530.0" height="205.0">
                    <blockTable colWidths="265,265" style="Table1">
                        <tr>
                            <td>Header Value 1</td>
                            <td><para style="normal2-center">Header Value 2</para></td>
                        </tr>
                    </blockTable>
        </place>

         <!-- ======================== footer =========================== -->
        <place x="33" y="55cm" width="530.0" height="205.0">
                <blockTable colWidths="265" style="Table1">
                            <tr><td><para style="normal2-center">Footer Value</para></td></tr>
                        </blockTable>
                    </place>
        </pageGraphics>
    </pageTemplate>
  </template>
于 2014-01-30T05:25:10.977 回答