odoo10 report自定义paperformat,就是自定义打印的纸张大小格式等
2017-11-23 00:57
399 查看
在report.xml中添加
<record id="paperformat_euro_qingjia" model="report.paperformat"> <field name="name">European A4 low margin</field> <field name="default" eval="True"/> <field name="format">custom</field> <field name="page_height">100</field> <field name="page_width">100</field> <field name="orientation">Portrait</field> <field name="margin_top">0</field> <field name="margin_bottom">0</field> <field name="margin_left">0</field> <field name="margin_right">0</field> <field name="header_line" eval="False"/> <field name="header_spacing">0</field> <field name="dpi">80</field> </record> <report id="action_report_qingjia" model="qingjia.qingjiadan" string="打印请假单" report_type="qweb-pdf" name="qingjia.qingjiadan_action_report" paperformat="paperformat_euro_qingjia" />
record id="paperformat_euro_qingjia" model="report.paperformat"record id可以改为自己定义的新名字。 model=report.paperformat不要改动,就用这个。 除了添加以上新代码,还需要在__mannifest__.xml中添加 'depends': ['base','report'] 注意这一行改为custom <field name="format">custom</field> 格式改为custom后,才可以对后续数据进行更改,其余的格式,比如A4,都是有标准数据的。
report.xml所有代码如下:
<odoo> <data> <record id="paperformat_euro_qingjia" model="report.paperformat"> <field name="name">European A4 low margin</field> <field name="default" eval="True"/> <field name="format">custom</field> <field name="page_height">100</field> <field name="page_width">100</field> <field name="orientation">Portrait</field> <field name="margin_top">0</field> <field name="margin_bottom">0</field> <field name="margin_left">0</field> <field name="margin_right">0</field> <field name="header_line" eval="False"/> <field name="header_spacing">0</field> <field name="dpi">80</field> </record> <report id="action_report_qingjia" model="qingjia.qingjiadan" string="打印请假单" report_type="qweb-pdf" name="qingjia.qingjiadan_action_report" paperformat="paperformat_euro_qingjia" /> <template id="minimal_layout" inherit_id="report.minimal_layout"> <xpath expr="//head" position="inside"> <link href="/qingjia/static/src/css/report.css" rel="stylesheet"/> </xpath> </template> <template id="qingjiadan_action_report"> <t t-call="report.html_container"> <div class="page"> <t t-call="qingjia.main_css"/> <table class="test-report"> <tr class="test-report"><td>名字</td><td>请假天数</td><td>开始日期</td><td>原因</td><td>状态</td></tr> <t t-foreach="docs" t-as="o"> <tr> <td><t t-raw="o.name" /></td> <td><t t-raw="o.days" /></td> <td><t t-raw="o.startdate" /></td> <td><t t-raw="o.reason" /></td> <td><t t-raw="o.state" /></td> </tr> </t> </table> </div> </t> </template> </data> </odoo>[/code]
完整的Module代码:http://download.csdn.net/download/qingtianjushi/10129385
引用:https://www.odoo.com/forum/help-1/tag/paperformat-6371/questions
相关文章推荐
- 水晶报表自定义纸张大小打印 (Crystal Report Print with custom paper size)
- 水晶报表自定义纸张大小打印 (Crystal Report Print with custom paper size)
- 水晶报表自定义纸张大小打印 (Crystal Report Print with custom paper size)
- odoo10 report添加自定义CSS—第二篇
- 打印自定义纸张大小
- SMARTFORM A5单据打印(自定义纸张/针式打印机)格式问题
- SMARTFORM A5单据打印(自定义纸张/针式打印机)格式问题
- C#中使用自定义的纸张大小打印文档
- 水晶报表自定义纸张大小打印 (转)
- 弄了一整天,终于把打印自定义纸张大小搞定了
- JAVA 打印,自定义纸张大小
- XtraReport报表打印自定义纸张问题
- Java打印,自定义纸张大小
- C# PrintDocument 自定义打印纸张大小和方向
- odoo10 report添加自定义CSS
- c#下crystalreport自定义纸张报表打印
- 水晶报表自定义纸张大小打印
- 水晶报表(CrystalReport)自定义纸张格式(custom Papersize)的实现
- 水晶报表中如何创建自定义的纸张大小格式?
- 打印自定义纸张大小