odoo10 report添加自定義CSS—第二篇

昨天寫了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>


整個模塊下載地址:http://download.csdn.net/download/qingtianjushi/10129142

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章