Report 如何在openerp中的rml报告中添加用户定义的标题?
除了在公司中定义的页眉/页脚之外,我如何为报告(例如交货订单中的领料单报告)添加新的页眉/页脚 在报告标记put header='False'中, 例如Report 如何在openerp中的rml报告中添加用户定义的标题?,report,openerp,rml,Report,Openerp,Rml,除了在公司中定义的页眉/页脚之外,我如何为报告(例如交货订单中的领料单报告)添加新的页眉/页脚 在报告标记put header='False'中, 例如 它不会打印公司中定义的默认标题。 然后在rml文件中找到标记,并用您的rml代码替换它。 例如 ***您的rml页眉和页脚*** 这样,您可以放置新的页眉和页脚 删除标题的一种方法是,在报告标记中声明它 <report header="False" auto="False" id="report_pro
它不会打印公司中定义的默认标题。
然后在rml文件中找到
标记,并用您的rml代码替换它。
例如
***您的rml页眉和页脚***
这样,您可以放置新的页眉和页脚 删除标题的一种方法是,在报告标记中声明它
<report
header="False"
auto="False"
id="report_product_history"
model="product.product"
name="stock.product.history"
string="Stock Level Forecast"/>
还可以使用该参数指定特定的标头。它默认为
'external'
,但可以是'internal'
或'internal scape'
,以使用公司配置中的另一个标题。您可以像这样在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>
[[company.logo或removeParentNode('image')]]
签名:
___________________________________
在报告集标题中='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>
[[company.logo或removeParentNode('image')]]
主割台
标题值1
标题值2
页脚值
谢谢你,唐。通过提供“内部”或“内部环境”,它从公司配置中获取标题。但我实际上想提供一个新的标题,而不是“外部”、“内部”或“内部”标题。所以我想我应该遵循阿图尔的答案。
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)
<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>
<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>