打印,补休分配
This commit is contained in:
@@ -218,30 +218,51 @@ class HrLeaveAllocation(models.Model):
|
||||
result = super(HrLeaveAllocation, self).action_validate()
|
||||
|
||||
for leave in self:
|
||||
if leave.holiday_status_id.name != '年假':
|
||||
continue
|
||||
if leave.holiday_status_id.name == '年假':
|
||||
vacation_date = leave.date_from.replace(day=1) if leave.date_from else fields.Date.today().replace(day=1)
|
||||
|
||||
reports_id = self.env['yuthon.vacation.reports'].search([
|
||||
('employee_id', '=', leave.employee_id.id),
|
||||
('vacation_date', '=', vacation_date)
|
||||
], limit=1)
|
||||
|
||||
if reports_id:
|
||||
leave_hours = leave.number_of_days_display * 8
|
||||
reports_id.write({
|
||||
'valid_date': leave.date_to,
|
||||
'leave_ids': [(0, 0, {
|
||||
'vacation_id': reports_id.id,
|
||||
'update_type': 'add',
|
||||
'update_date': fields.Datetime.now(),
|
||||
'valid_date': leave.date_from,
|
||||
'update_lines': leave_hours,
|
||||
'text': '年假分配'
|
||||
})]
|
||||
})
|
||||
reports_id.update_line()
|
||||
|
||||
vacation_date = leave.date_from.replace(day=1) if leave.date_from else fields.Date.today().replace(day=1)
|
||||
|
||||
reports_id = self.env['yuthon.vacation.reports'].search([
|
||||
('employee_id', '=', leave.employee_id.id),
|
||||
('vacation_date', '=', vacation_date)
|
||||
], limit=1)
|
||||
|
||||
if reports_id:
|
||||
leave_hours = leave.number_of_days_display * 8
|
||||
reports_id.write({
|
||||
'valid_date': leave.date_to,
|
||||
'leave_ids': [(0, 0, {
|
||||
'vacation_id': reports_id.id,
|
||||
'update_type': 'add',
|
||||
'update_date': fields.Datetime.now(),
|
||||
'valid_date': leave.date_from,
|
||||
'update_lines': leave_hours,
|
||||
'text': '年假分配'
|
||||
})]
|
||||
})
|
||||
reports_id.update_line()
|
||||
elif leave.holiday_status_id.name == '补休':
|
||||
vacation_date = leave.date_from.replace(day=1) if leave.date_from else fields.Date.today().replace(day=1)
|
||||
|
||||
reports_id = self.env['yuthon.vacation.reports'].search([
|
||||
('employee_id', '=', leave.employee_id.id),
|
||||
('vacation_date', '=', vacation_date)
|
||||
], limit=1)
|
||||
|
||||
if reports_id:
|
||||
rest_hours = leave.number_of_days_display * 8
|
||||
reports_id.write({
|
||||
'valid_date1': leave.date_to,
|
||||
'overtime_ids': [(0, 0, {
|
||||
'vacation_id': reports_id.id,
|
||||
'update_type': 'add',
|
||||
'update_date': fields.Datetime.now(),
|
||||
'valid_date': leave.date_to,
|
||||
'workday': rest_hours,
|
||||
'text': leave.name or '补休分配'
|
||||
})]
|
||||
})
|
||||
reports_id.update_line()
|
||||
|
||||
return result
|
||||
|
||||
|
||||
@@ -114,7 +114,9 @@
|
||||
'views/property_menu_all.xml',
|
||||
'report/property_lease_contract_print_report.xml',
|
||||
'report/property_lease_contract_print_templates.xml',
|
||||
|
||||
'report/property_supervising_approval_print_report.xml',
|
||||
'report/property_supervising_approval_print_templates.xml'
|
||||
|
||||
],
|
||||
|
||||
'assets': {
|
||||
|
||||
@@ -58,6 +58,13 @@ class PropertySupervisingApproval(models.Model):
|
||||
}
|
||||
}
|
||||
|
||||
def action_print_property_supervising_approval(self):
|
||||
"""打印建设工程委托监理合同审批"""
|
||||
self.ensure_one()
|
||||
report_ref = self.env.ref('yuthon_property_approval.action_property_supervising_approval_print_report')
|
||||
return report_ref.sudo().report_action(self)
|
||||
|
||||
|
||||
class SupervisingWayLine(models.Model):
|
||||
_name = 'supervising.way.line'
|
||||
_description = '施工支付方式'
|
||||
|
||||
@@ -0,0 +1,22 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<odoo>
|
||||
<!-- 建设工程委托监理合同审批打印报表 -->
|
||||
<record id="paperformat_property_supervising_approval" model="report.paperformat">
|
||||
<field name="name">Property Supervising Approval A4</field>
|
||||
<field name="format">A4</field>
|
||||
<field name="margin_top">5</field>
|
||||
<field name="orientation">Portrait</field>
|
||||
</record>
|
||||
|
||||
<record id="action_property_supervising_approval_print_report" model="ir.actions.report">
|
||||
<field name="name">建设工程委托监理合同审批</field>
|
||||
<field name="paperformat_id" ref="yuthon_property_approval.paperformat_property_supervising_approval"/>
|
||||
<field name="model">property.supervising.approval</field>
|
||||
<field name="report_type">qweb-pdf</field>
|
||||
<field name="report_name">yuthon_property_approval.property_supervising_approval_print_template</field>
|
||||
<field name="report_file">yuthon_property_approval.property_supervising_approval_print_template</field>
|
||||
<field name="print_report_name">'建设工程委托监理合同审批%s_%s_%s' % (object.display_name or object.code or '', object.users_id.name or '', ((object.log_ids.filtered(lambda l: l.name == '归档')[-1].lase_click_date or object.log_ids.filtered(lambda l: l.name == '归档')[-1].date_create).strftime('%Y-%m-%d') if object.log_ids.filtered(lambda l: l.name == '归档') else ''))</field>
|
||||
<field name="binding_model_id" ref="model_property_supervising_approval"/>
|
||||
<field name="binding_type">report</field>
|
||||
</record>
|
||||
</odoo>
|
||||
@@ -0,0 +1,148 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<odoo>
|
||||
<template id="property_supervising_approval_print_template">
|
||||
<t t-call="web.html_container">
|
||||
<t t-foreach="docs" t-as="doc">
|
||||
<t t-call="web.external_layout">
|
||||
<div class="page">
|
||||
<style type="text/css">
|
||||
.po-wrap { max-width: 800px; width: auto; margin: 0 auto; font-size: 13px; }
|
||||
.po-title { text-align: center; font-weight: bold; font-size: 20px; padding: 10px 0 14px; }
|
||||
table.po { max-width: 800px; width: 100%; border-collapse: collapse; table-layout: auto; margin: 0 auto; }
|
||||
table.po td { border: 1px solid #000; padding: 6px; vertical-align: top; }
|
||||
.label { background: #d4e6f1; font-weight: bold; text-align: center; width: 120px; }
|
||||
.section { text-align: center; font-weight: bold; background: #f2f2f2; border: 1px solid #000; padding: 6px 0; }
|
||||
.sect { text-align: center; font-weight: bold; background-color: #d4e6f1; border: 1px solid #000; padding: 6px 0; }
|
||||
.subhead { background: #f2f2f2; font-weight: bold; text-align: center; }
|
||||
/* 新增边框隐藏样式 */
|
||||
.no-right-border { border-right: none !important; }
|
||||
.no-left-border { border-left: none !important; }
|
||||
/* 新增对齐样式 */
|
||||
.text-center { text-align: center !important; }
|
||||
.text-right { text-align: right !important; }
|
||||
</style>
|
||||
|
||||
<div class="po-wrap">
|
||||
<div class="po-title">建设工程委托监理合同审批</div>
|
||||
|
||||
<!-- 标题下方:承办部门 + 流水号 -->
|
||||
<div style="margin-bottom:8px; text-align:left;">
|
||||
<span t-esc="doc.department_id.name or ''"/>
|
||||
<span style="margin-left:40px;">流水号:<span t-esc="doc.code or ''"/></span>
|
||||
</div>
|
||||
|
||||
<!-- 基础信息 -->
|
||||
<table class="po">
|
||||
<tr>
|
||||
<td class="label" width="15%">合同编号</td>
|
||||
<td width="35%"><span t-esc="doc.name or ''"/></td>
|
||||
<td class="label" width="15%">标题</td>
|
||||
<td width="35%"><span t-esc="doc.name_title or ''"/></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="label">甲方单位</td>
|
||||
<td><span t-esc="doc.company_a_id.name or ''"/></td>
|
||||
<td class="label">乙方单位</td>
|
||||
<td><span t-esc="doc.company_b_id.name or ''"/></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="label">物业地址</td>
|
||||
<td colspan="3"><span t-esc="doc.property_address or ''"/></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="label">代理期限</td>
|
||||
<td><span t-esc="doc.start_date and doc.start_date.strftime('%Y-%m-%d') or ''"/></td>
|
||||
<td width="10%" class="label">至</td>
|
||||
<td><span t-esc="doc.end_date and doc.end_date.strftime('%Y-%m-%d') or ''"/></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="label">审定价格</td>
|
||||
<td><span t-esc="'%.2f' % (doc.review_price or 0.0)"/></td>
|
||||
<td class="label">浮动比例</td>
|
||||
<td><span t-esc="doc.floating or ''"/></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="label">合同金额</td>
|
||||
<td><span t-esc="'%.2f' % (doc.contract_amount or 0.0)"/></td>
|
||||
<td class="label">业务类型</td>
|
||||
<td><span t-esc="doc.business_type or ''"/></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="label">付款方式</td>
|
||||
<td colspan="3"><span t-esc="dict(doc._fields['payment_methods'].selection).get(doc.payment_methods, '')"/></td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
<!-- 物业信息 -->
|
||||
<div class="section">物业信息</div>
|
||||
<table class="po">
|
||||
<tr class="subhead">
|
||||
<td width="20%">物业地址</td>
|
||||
<td width="20%">管理线路</td>
|
||||
<td width="20%">物业面积(㎡)</td>
|
||||
<td width="20%">评估单价(元/㎡)</td>
|
||||
<td width="20%">评估总价(元)</td>
|
||||
</tr>
|
||||
<t t-if="doc.lease_ids">
|
||||
<t t-foreach="doc.lease_ids" t-as="line">
|
||||
<tr>
|
||||
<td><span t-esc="line.address_id.name or ''"/></td>
|
||||
<td><span t-esc="line.admin_line_id.name or ''"/></td>
|
||||
<td><span t-esc="'%.2f' % (line.property_area or 0.0)"/></td>
|
||||
<td><span t-esc="'%.2f' % (line.evaluate_unit_price or 0.0)"/></td>
|
||||
<td><span t-esc="'%.2f' % (line.property_area * line.evaluate_unit_price or 0.0)"/></td>
|
||||
</tr>
|
||||
</t>
|
||||
</t>
|
||||
<t t-else="">
|
||||
<tr><td colspan="5" style="text-align:center;">暂无物业信息</td></tr>
|
||||
</t>
|
||||
</table>
|
||||
|
||||
<!-- 支付方式 -->
|
||||
<div class="section">支付方式</div>
|
||||
<table class="po">
|
||||
<tr class="subhead">
|
||||
<td width="30%">付款节点</td>
|
||||
<td width="30%">金额(元)</td>
|
||||
<td width="40%">备注</td>
|
||||
</tr>
|
||||
<t t-if="doc.supervising_way_ids">
|
||||
<t t-foreach="doc.supervising_way_ids" t-as="line">
|
||||
<tr>
|
||||
<td>
|
||||
<span t-if="line.payment_nodes == 'first'">一期</span>
|
||||
<span t-if="line.payment_nodes == 'second'">二期</span>
|
||||
<span t-if="line.payment_nodes == 'third'">三期</span>
|
||||
<span t-if="line.payment_nodes == 'fourth'">四期</span>
|
||||
</td>
|
||||
<td><span t-esc="'%.2f' % (line.amount or 0.0)"/></td>
|
||||
<td><span t-esc="line.remake or ''"/></td>
|
||||
</tr>
|
||||
</t>
|
||||
</t>
|
||||
<t t-else="">
|
||||
<tr><td colspan="3" style="text-align:center;">暂无支付方式</td></tr>
|
||||
</t>
|
||||
</table>
|
||||
|
||||
<!-- 审批详情 -->
|
||||
<div class="sect">审批详情</div>
|
||||
<table class="po">
|
||||
<t t-set="logs_ordered" t-value="doc.log_ids.sorted(lambda x: x.date_create or '')"/>
|
||||
<t t-foreach="logs_ordered" t-as="log">
|
||||
<tr>
|
||||
<td width="15%"><span t-esc="log.name or '节点'"/></td>
|
||||
<td width="25%"><span t-esc="log.user_id.name or ''"/></td>
|
||||
<td width="25%"><span t-esc="log.date_create and log.date_create.strftime('%Y-%m-%d %H:%M') or ''"/></td>
|
||||
<td width="35%"><span t-esc="log.comment or ''"/></td>
|
||||
</tr>
|
||||
</t>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
</t>
|
||||
</t>
|
||||
</t>
|
||||
</template>
|
||||
</odoo>
|
||||
@@ -18,6 +18,12 @@
|
||||
<field name="model">property.supervising.approval</field>
|
||||
<field name="arch" type="xml">
|
||||
<form string="建设工程委托监理合同审批" create="0">
|
||||
<header>
|
||||
<button name="action_print_property_supervising_approval"
|
||||
type="object"
|
||||
string="打印"
|
||||
class="btn-primary"/>
|
||||
</header>
|
||||
<sheet>
|
||||
<group col="3">
|
||||
<group>
|
||||
|
||||
Reference in New Issue
Block a user