问题描述
我正在用odoo创建自定义pdf报告。定制报告应代表基于odoo合同的员工的工作合同。为此,我有两个文件employee_contract_report.xml和报告文件contract.xml。创建报告并显示大多数字段,但开始日期字段以及工作时间和工作时间费率字段除外。这些也是我通过contract_id而不是直接通过employee模型获得的唯一字段。我猜错误出在那儿。有谁知道为什么这不起作用?非常感谢!
employee_contract_report.xml看起来像这样:
<?xml version="1.0" encoding="utf-8"?>
<odoo>
<report
id="report_employee_contract"
string="Employee Contract"
model="hr.employee"
report_type="qweb-pdf"
name="mycompany.report_employee_contract"
file="mycompany.report_employee_contract"
/>
</odoo>
employee_contract_report.xml看起来像这样(失败的代码段):
<?xml version="1.0" encoding="utf-8"?>
<odoo>
<template id="report_employee_contract">
<t t-call="web.html_container">
<t t-foreach="docs" t-as="o">
<t t-call="web.external_layout">
<style>
.thick {
font-weight: bold;
}
</style>
<h1>Leih-Arbeitsvertrag</h1>
<div class="page">
<!-- Company Informations -->
<table id="company-infos" class="table table-sm table-bordered">
<tr>
<td>
<strong>zwischen</strong>
</td>
<td>
<div>
<span t-field="o.company_id.name"/>
</div>
<div>
<span t-field="o.company_id.street"/>
</div>
<div>
<span t-field="o.company_id.street2" t-if="o.company_id.street2"/>
</div>
<div>
<span t-field="o.company_id.city"/>
<span t-field="o.company_id.state_id"/>
<span t-field="o.company_id.zip"/>
</div>
<div>
<span t-field="o.company_id.country_id"/>
</div>
</td>
</tr>
</table>
<table id="employee-infos" class="table table-sm table-bordered">
<tr>
<td>
<strong>und</strong>
</td>
<td>
<div>
<span t-field="o.name"/>
</div>
<div>
<span t-field="o.address_home_id"/>
</div>
</td>
</tr>
</table>
</div>
<h2>Arbeitsbeginn</h2>
<div>
Das Arbeitsverhältnis beginnt am<span t-field="o.contract_id.date_start"/>.
</div>
<h2>Arbeitszeit</h2>
<div>
Die regelmässige wöchentliche Normalarbeitszeit beträgt
<span t-field="o.contract_id.resource_calendar_id.full_time_required_hours"/>
Stunden bei einem Anstellungspensum
von<span t-field="o.contract_id.resource_calendar_id.work_time_rate"/>.
</div>
</t>
</t>
</t>
</template>
</odoo>
这是缺少开始日期的输出:
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)