离职申请打印
This commit is contained in:
@@ -56,6 +56,8 @@
|
||||
|
||||
'report/contract_review_report.xml',
|
||||
'report/contract_review_report_templates.xml',
|
||||
'report/leaving_approval_report.xml', # 新增
|
||||
'report/leaving_approval_report_templates.xml',
|
||||
|
||||
'wizard/yuthon_website_employee_wizard.xml',
|
||||
'wizard/interview_approval_wizard.xml',
|
||||
|
||||
@@ -62,6 +62,12 @@ class YuthonLeavingApproval(models.Model):
|
||||
record.employee_id.contract_id.state = 'cancel'
|
||||
record.is_execution = True
|
||||
|
||||
def action_print_leaving_approval(self):
|
||||
"""
|
||||
打印离职申请单
|
||||
"""
|
||||
return self.env.ref('yuthon_hr_employee_approval.action_leaving_approval_report').report_action(self)
|
||||
|
||||
|
||||
class HrJobType(models.Model):
|
||||
_name = "hr.job.type"
|
||||
|
||||
@@ -0,0 +1,21 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<odoo>
|
||||
<data>
|
||||
<record id="paperformat_leaving_approval_small" model="report.paperformat">
|
||||
<field name="name">Leaving Approval Small Top Margin</field>
|
||||
<field name="format">A4</field>
|
||||
<field name="margin_top">5</field>
|
||||
</record>
|
||||
<record id="action_leaving_approval_report" model="ir.actions.report">
|
||||
<field name="name">离职申请</field>
|
||||
<field name="paperformat_id" ref="yuthon_hr_employee_approval.paperformat_leaving_approval_small"/>
|
||||
<field name="model">yuthon.leaving.approval</field>
|
||||
<field name="report_type">qweb-pdf</field>
|
||||
<field name="report_name">yuthon_hr_employee_approval.leaving_approval_report_document</field>
|
||||
<field name="report_file">yuthon_hr_employee_approval.leaving_approval_report_document</field>
|
||||
<field name="binding_model_id" ref="model_yuthon_leaving_approval"/>
|
||||
<field name="binding_type">report</field>
|
||||
<field name="print_report_name">'离职申请 - %s' % (object.name or '')</field>
|
||||
</record>
|
||||
</data>
|
||||
</odoo>
|
||||
@@ -0,0 +1,212 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<odoo>
|
||||
<data>
|
||||
<template id="leaving_approval_report_document">
|
||||
<t t-call="web.html_container">
|
||||
<t t-foreach="docs" t-as="doc">
|
||||
<t t-call="web.external_layout">
|
||||
<style type="text/css">
|
||||
table { border-collapse: collapse; width: 800px; margin: 0 auto; table-layout: fixed; }
|
||||
td { border: 1px solid #000; padding: 6px; text-align: center; }
|
||||
.title {
|
||||
text-align: center;
|
||||
font-weight: bold;
|
||||
font-size: 18px;
|
||||
padding: 8px 0;
|
||||
}
|
||||
.header-cell { font-weight: bold; background-color: #d4e6f1;}
|
||||
.attachment-list { text-align: left; }
|
||||
.no-right-border { border-right: none !important; }
|
||||
.no-left-border { border-left: none !important; }
|
||||
.vertical-middle { vertical-align: middle; }
|
||||
</style>
|
||||
|
||||
<!-- 离职申请标题 -->
|
||||
<div class="title" style="text-align:center; font-weight:bold; font-size:18px; padding:12px 0; margin-bottom:10px;">
|
||||
离职申请
|
||||
</div>
|
||||
|
||||
<table>
|
||||
<colgroup>
|
||||
<col style="width:20%"/>
|
||||
<col style="width:30%"/>
|
||||
<col style="width:20%"/>
|
||||
<col style="width:30%"/>
|
||||
</colgroup>
|
||||
|
||||
<!-- 标题行 -->
|
||||
<tr>
|
||||
<td class="header-cell"><strong>标题</strong></td>
|
||||
<td colspan="3"><span t-esc="doc.name"/></td>
|
||||
</tr>
|
||||
|
||||
<!-- 事由单独占一行 -->
|
||||
<tr>
|
||||
<td class="header-cell"><strong>事由</strong></td>
|
||||
<td colspan="3"><span t-esc="doc.reason_application"/></td>
|
||||
</tr>
|
||||
|
||||
<!-- 附件 -->
|
||||
<tr>
|
||||
<td class="header-cell"><strong>附件</strong></td>
|
||||
<td colspan="3" class="attachment-list">
|
||||
<t t-foreach="doc.documents_ids" t-as="att">
|
||||
<div><t t-esc="att.name"/></div>
|
||||
</t>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<!-- 离职信息标题行 -->
|
||||
<tr>
|
||||
<td colspan="4" style="background-color: #d4e6f1; text-align: center;"><strong>离职信息</strong></td>
|
||||
</tr>
|
||||
|
||||
<!-- 离职信息第一行 -->
|
||||
<tr>
|
||||
<td class="header-cell"><strong>员工</strong></td>
|
||||
<td><span t-esc="doc.employee_id.name"/></td>
|
||||
<td class="header-cell"><strong>入职日期</strong></td>
|
||||
<td><span t-esc="doc.onboarding_time"/></td>
|
||||
</tr>
|
||||
|
||||
<!-- 离职信息第二行 -->
|
||||
<tr>
|
||||
<td class="header-cell"><strong>部门</strong></td>
|
||||
<td><span t-esc="doc.department_id.name"/></td>
|
||||
<td class="header-cell"><strong>离职类型</strong></td>
|
||||
<td>
|
||||
<t t-if="doc.departure_type == 'voluntary'">主动离职</t>
|
||||
<t t-elif="doc.departure_type == 'contract_expired'">合同到期</t>
|
||||
<t t-elif="doc.departure_type == 'negotiated_termination'">协商解除</t>
|
||||
<t t-elif="doc.departure_type == 'other'">其他</t>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<!-- 离职信息第三行 -->
|
||||
<tr>
|
||||
<td class="header-cell"><strong>联系方式</strong></td>
|
||||
<td><span t-esc="doc.phone"/></td>
|
||||
<td rowspan="2" class="header-cell vertical-middle"><strong>离职日期</strong></td>
|
||||
<td rowspan="2" class="vertical-middle"><span t-esc="doc.separation_date"/></td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td class="header-cell"><strong>身份证号</strong></td>
|
||||
<td><span t-esc="doc.id_number"/></td>
|
||||
</tr>
|
||||
|
||||
<!-- 工作交接 -->
|
||||
<t t-if="doc.handover_line_ids">
|
||||
<tr>
|
||||
<td colspan="4" style="background-color: #d4e6f1; text-align: center;"><strong>工作交接</strong></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="header-cell"><strong>交接事项</strong></td>
|
||||
<td class="header-cell"><strong>交接人</strong></td>
|
||||
<td class="header-cell"><strong>交接状态</strong></td>
|
||||
<td class="header-cell"><strong>备注</strong></td>
|
||||
</tr>
|
||||
<t t-foreach="doc.handover_line_ids" t-as="handover">
|
||||
<tr>
|
||||
<td><span t-esc="handover.name"/></td>
|
||||
<td><span t-esc="handover.employee_id.name"/></td>
|
||||
<td>
|
||||
<t t-if="handover.state == 'done'">已完成</t>
|
||||
<t t-elif="handover.state == 'undone'">未完成</t>
|
||||
</td>
|
||||
<td><span t-esc="handover.remake"/></td>
|
||||
</tr>
|
||||
</t>
|
||||
</t>
|
||||
|
||||
<!-- 资产归还 -->
|
||||
<t t-if="doc.return_line_ids">
|
||||
<tr>
|
||||
<td colspan="4" style="background-color: #d4e6f1; text-align: center;"><strong>资产归还</strong></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="header-cell"><strong>资产类型</strong></td>
|
||||
<td class="header-cell"><strong>型号</strong></td>
|
||||
<td class="header-cell"><strong>归还状态</strong></td>
|
||||
<td class="header-cell"><strong>备注</strong></td>
|
||||
</tr>
|
||||
<t t-foreach="doc.return_line_ids" t-as="return_line">
|
||||
<tr>
|
||||
<td><span t-esc="return_line.name"/></td>
|
||||
<td><span t-esc="return_line.model"/></td>
|
||||
<td>
|
||||
<t t-if="return_line.state == 'done'">已完成</t>
|
||||
<t t-elif="return_line.state == 'undone'">未完成</t>
|
||||
</td>
|
||||
<td><span t-esc="return_line.remake"/></td>
|
||||
</tr>
|
||||
</t>
|
||||
</t>
|
||||
|
||||
<!-- 办公用品 -->
|
||||
<t t-if="doc.goods_line_ids">
|
||||
<tr>
|
||||
<td colspan="4" style="background-color: #d4e6f1; text-align: center;"><strong>办公用品</strong></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="header-cell"><strong>物品名称</strong></td>
|
||||
<td class="header-cell"><strong>数量</strong></td>
|
||||
<td class="header-cell"><strong>归还状态</strong></td>
|
||||
<td class="header-cell"><strong>备注</strong></td>
|
||||
</tr>
|
||||
<t t-foreach="doc.goods_line_ids" t-as="goods">
|
||||
<tr>
|
||||
<td><span t-esc="goods.name"/></td>
|
||||
<td><span t-esc="goods.number"/></td>
|
||||
<td>
|
||||
<t t-if="goods.state == 'done'">已完成</t>
|
||||
<t t-elif="goods.state == 'undone'">未完成</t>
|
||||
</td>
|
||||
<td><span t-esc="goods.remake"/></td>
|
||||
</tr>
|
||||
</t>
|
||||
</t>
|
||||
|
||||
<!-- 工资条 -->
|
||||
<t t-if="doc.salary_line_ids">
|
||||
<tr>
|
||||
<td colspan="4" style="background-color: #d4e6f1; text-align: center;"><strong>工资条</strong></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="header-cell"><strong>开始日期</strong></td>
|
||||
<td class="header-cell"><strong>结束日期</strong></td>
|
||||
<td class="header-cell"><strong>实发工资</strong></td>
|
||||
<td class="header-cell"><strong>备注</strong></td>
|
||||
</tr>
|
||||
<t t-foreach="doc.salary_line_ids" t-as="salary">
|
||||
<tr>
|
||||
<td><span t-esc="salary.start_date"/></td>
|
||||
<td><span t-esc="salary.end_date"/></td>
|
||||
<td><span t-esc="salary.salary"/></td>
|
||||
<td><span t-esc="salary.remake"/></td>
|
||||
</tr>
|
||||
</t>
|
||||
</t>
|
||||
|
||||
<!-- 审批详情 -->
|
||||
<tr>
|
||||
<td colspan="4" style="background-color: #d4e6f1; text-align: center;"><strong>审批详情</strong></td>
|
||||
</tr>
|
||||
<t t-foreach="doc.log_ids.sorted('sequence')" t-as="log">
|
||||
<tr>
|
||||
<td colspan="1"><span t-esc="log.name"/></td>
|
||||
<td class="no-right-border" colspan="2"><span t-esc="log.comment"/></td>
|
||||
<td class="no-left-border" colspan="1">
|
||||
<t t-if="log.done_by">
|
||||
<span t-esc="log.done_by.name"/> <span t-esc="log.lase_click_date and log.lase_click_date.strftime('%Y-%m-%d')"/>
|
||||
</t>
|
||||
</td>
|
||||
</tr>
|
||||
</t>
|
||||
</table>
|
||||
</t>
|
||||
</t>
|
||||
</t>
|
||||
</template>
|
||||
</data>
|
||||
</odoo>
|
||||
@@ -16,6 +16,12 @@
|
||||
<field name="model">yuthon.leaving.approval</field>
|
||||
<field name="arch" type="xml">
|
||||
<form create="0">
|
||||
<header>
|
||||
<button name="action_print_leaving_approval"
|
||||
string="打印"
|
||||
type="object"
|
||||
class="btn-primary"/>
|
||||
</header>
|
||||
<sheet>
|
||||
<widget name="web_ribbon" title="普件" bg_color="text-bg-success"
|
||||
invisible="urgency_level != 'normal'"/>
|
||||
|
||||
Reference in New Issue
Block a user