Odoo中文网|Odoo实施培训

标题: odoo10 report添加自定义CSS [打印本页]

作者: 南帝    时间: 2018-2-7 21:53
标题: odoo10 report添加自定义CSS
添加下列代码到xml文件中,这段代码放哪里都行,再新建一个xml也可以,只要在manifest中引入了就行。下面用到的report.css是自己新建一个即可,名字随便改。
<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>
整个report.xml文件:
<odoo>  
    <data>  
  
    <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>  
  
    <report id="action_report_qingjia"  
        model="qingjia.qingjiadan"  
        string="打印请假单"  
        report_type="qweb-pdf"  
        name="qingjia.qingjiadan_action_report"  
    />  
  
    </data>  
</odoo>  






欢迎光临 Odoo中文网|Odoo实施培训 (http://www.chinaodoo.net/) Powered by Discuz! X3.2