Odoo报表的report标签和报表格式定义
- 1、下载文档前请自行甄别文档内容的完整性,平台不提供额外的编辑、内容补充、找答案等附加服务。
- 2、"仅部分预览"的文档,不可在线预览部分如存在完整性等问题,可反馈申请退款(可完整预览的文档不适用该条件!)。
- 3、如文档侵犯您的权益,请联系客服反馈,我们会尽快为您处理(人工客服工作时间:9:00-18:30)。
Odoo报表的report标签和报表格式定义转载请注明原⽂地址:
⼀:Report标签
report标签可⽤于定义⼀条报表记录。
属性有:
1)id
⽣成的数据的id。
2)name (必选)
报表名,⽤于查找及描述。
3)model (必选)
报表记录所对应的模型。
4)report_type (必选)
qweb-pdf| qweb-html
5)report_name
输出pdf时⽂件名。
6)groups
⽤于指定可以查看、使⽤该报表的⽤户组。
7)attachment_use
如果设置为true时,该报表会以记录的附件的形式保存,⼀般⽤于⼀次⽣成、多次使⽤的报表。
8)attachment
⽤于定义报表名的python表达式,使记录可以通过object对象访问。
9)paperformat
⽤于打印报表的⽂件格式的外部id(默认是公司的格式)(可以⾃定义格式)。
例⼦:
<report
id="account_invoices"
model="account.invoice"
string="Invoices"
report_type="qweb-pdf"
name="account.report_invoice"
file="account.report_invoice"
attachment_use="True"
attachment="(object.state in ('open','paid')) and
('INV'+(object.number or '').replace('/','')+'.pdf')" //拼接⽂件名
/>
⼆:报表格式
报表格式⽤report.paperformat记录来定义,字段有:
1)name (必选)
⽤于查找及区分的名字。
2)description
格式的描述。
3)format
⼀个预定义的纸张⼤⼩格式如(A0-A9,B0-B10等)或⾃定义custom,默认是A4。
4)dpi
输出的DPI,默认90。
5)margin_top, margin_bottom, margin_left, margin_right
以 mm 为单位的margin值。
6)page_height, page_width
以 mm 为单位的页⾯宽⾼尺⼨值。
7)orientation
纸张横向或纵向打印。
8)Landscape , Portrait header_line
boolean类型,是否显⽰标题⾏。
9)header_spacing
以 mm 为单位的头部空⽩尺⼨。
例⼦:
<record id="paperformat_frenchcheck" model="report.paperformat">
<field name="name">French Bank Check</field>
<field name="default" eval="True"/>
<field name="format">custom</field>
<field name="page_height">80</field>
<field name="page_width">175</field>
<field name="orientation">Portrait</field>
<field name="margin_top">3</field>
<field name="margin_bottom">3</field>
<field name="margin_left">3</field>
<field name="margin_right">3</field>
<field name="header_line" eval="False"/>
<field name="header_spacing">3</field>
<field name="dpi">80</field>
</record>。