Merge pull request !11971 from 李鹏宇/dev_wang
This commit is contained in:
李鹏宇
2026-06-09 02:26:57 +00:00
committed by Gitee
5 changed files with 152 additions and 4 deletions
+1
View File
@@ -34,6 +34,7 @@
'views/official_menus.xml',
'report/official_print_action.xml',
'report/official_print_template.xml',
'report/property_official_print_template.xml',
'report/file_processing_report.xml',
'report/file_processing_report_templates.xml',
'report/sub_enterprises_report.xml',
+4 -3
View File
@@ -297,7 +297,7 @@ class YuthonOfficial(models.Model):
})
def action_print_official(self):
"""表单按钮触发打印发文审批单"""
"""表单按钮触发打印行政发文审批单"""
self.ensure_one()
report = self.env.ref('yuthon_official.action_official_print_report')
return report.report_action(self)
@@ -319,6 +319,7 @@ class YuthonPropertyOfficial(models.Model):
_inherit = ['soong.workflow.mixin', 'mail.thread.main.attachment', 'mail.activity.mixin']
_rec_name = 'name'
name = fields.Char(string="标题")
text = fields.Text(string="标题", compute='_compute_text', store=True)
code = fields.Char(string="编号", default=lambda self: self.env['ir.sequence'].next_by_code('official_code'))
@@ -563,9 +564,9 @@ class YuthonPropertyOfficial(models.Model):
})
def action_print_official(self):
"""表单按钮触发打印发文审批单"""
"""表单按钮触发打印物业发文审批单"""
self.ensure_one()
report = self.env.ref('yuthon_official.action_official_print_report')
report = self.env.ref('yuthon_official.action_property_official_print_report')
return report.report_action(self)
def button_transfer(self):
@@ -18,5 +18,16 @@
<field name="binding_type">report</field>
<field name="print_report_name">'行政发文%s_%s_%s' % (object.name or '', object.code or '', (object.date and object.date.strftime('%Y-%m-%d') or ''))</field>
</record>
<record id="action_property_official_print_report" model="ir.actions.report">
<field name="name">物业发文</field>
<field name="paperformat_id" ref="yuthon_official.paperformat_official_small"/>
<field name="model">yuthon.property.official</field>
<field name="report_type">qweb-pdf</field>
<field name="report_name">yuthon_official.property_official_print_template</field>
<field name="report_file">yuthon_official.property_official_print_template</field>
<field name="binding_model_id" ref="model_yuthon_property_official"/>
<field name="binding_type">report</field>
<field name="print_report_name">'物业发文%s_%s_%s' % (object.name or '', object.code or '', (object.date and object.date.strftime('%Y-%m-%d') or ''))</field>
</record>
</data>
</odoo>
@@ -104,7 +104,7 @@
<td class="header-cell"><strong>用章类型</strong></td>
<td colspan="3" class="attachment-list">
<t t-foreach="doc.type_stamp_ids" t-as="stamp">
<span t-esc="stamp.name"/>
<span t-esc="stamp.display_name"/>
<t t-if="not stamp_last">、</t>
</t>
</td>
@@ -0,0 +1,135 @@
<?xml version="1.0" encoding="UTF-8"?>
<odoo>
<template id="property_official_print_template">
<t t-call="web.html_container">
<t t-foreach="docs" t-as="doc">
<t t-call="web.external_layout">
<style type="text/css">
/* 表格纵向版式:自适应,最大800px 居中 */
table { border-collapse: collapse; width: 100%; max-width: 800px; margin: 0 auto; table-layout: fixed; }
td { border: 1px solid #000; padding: 6px; text-align: center; vertical-align: middle; }
.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; }
</style>
<!-- 流水号:页面左上角,位于标题之上,浅灰色 -->
<div style="margin-bottom:8px; text-align:left; color:#999999;">
流水号:<span t-esc="doc.code or ''"/>
</div>
<!-- 物业发文标题 - 不在表格内 -->
<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:15%"/>
<col style="width:35%"/>
<col style="width:15%"/>
<col style="width:35%"/>
</colgroup>
<tr>
<td class="header-cell"><strong>标题</strong></td>
<td colspan="3"><span t-esc="doc.name or ''"/></td>
</tr>
<!-- 发文字号:仅在is_cold为True时显示 -->
<tr t-if="doc.is_cold">
<td class="header-cell"><strong>发文字号</strong></td>
<td colspan="3"><span t-esc="doc.reference_cold or ''"/></td>
</tr>
<tr>
<td class="header-cell"><strong>紧急度</strong></td>
<td>
<span t-if="doc.urgency_level == 'normal'">一般</span>
<span t-if="doc.urgency_level == 'urgent'">紧急</span>
<span t-if="doc.urgency_level == 'extra_urgent'">特急</span>
</td>
<td class="header-cell"><strong>密级</strong></td>
<td>
<span t-if="doc.secret_level == 'normal'">一般</span>
<span t-if="doc.secret_level == 'urgent'">秘密</span>
<span t-if="doc.secret_level == 'secret'">机密</span>
<span t-if="doc.secret_level == 'so_secret'">绝密</span>
</td>
</tr>
<tr>
<td class="header-cell"><strong>主送单位</strong></td>
<td colspan="3" class="attachment-list">
<t t-foreach="doc.main_flats_ids" t-as="main_flat">
<span t-esc="main_flat.name"/>
<t t-if="not main_flat_last">、</t>
</t>
</td>
</tr>
<tr>
<td class="header-cell"><strong>抄送单位</strong></td>
<td colspan="3" class="attachment-list">
<t t-foreach="doc.copy_flats_ids" t-as="copy_flat">
<span t-esc="copy_flat.name"/>
<t t-if="not copy_flat_last">、</t>
</t>
</td>
</tr>
<tr>
<td class="header-cell"><strong>文件内容</strong></td>
<td colspan="3" class="attachment-list"><span t-field="doc.main_text"/></td>
</tr>
<tr>
<td class="header-cell"><strong>附件</strong></td>
<td colspan="3" class="attachment-list">
<t t-foreach="doc.official_documents_ids" t-as="att">
<div><t t-esc="att.name"/></div>
</t>
</td>
</tr>
<!-- 用章类型:仅在is_chapter为'yes'时显示 -->
<tr t-if="doc.is_chapter == 'yes'">
<td class="header-cell"><strong>用章类型</strong></td>
<td colspan="3" class="attachment-list">
<t t-foreach="doc.type_stamp_ids" t-as="stamp">
<span t-esc="stamp.display_name"/>
<t t-if="not stamp_last">、</t>
</t>
</td>
</tr>
<!-- 关联议题:仅在is_meet为True时显示 -->
<tr t-if="doc.is_meet">
<td class="header-cell"><strong>关联议题</strong></td>
<td colspan="3"><span t-esc="doc.related_issues_id.name or ''"/></td>
</tr>
<tr>
<td colspan="4" style="background-color: #d4e6f1; text-align: center;"><strong>审批详情</strong></td>
</tr>
<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 colspan="1"><span t-esc="log.name or '节点'"/></td>
<!-- 核心修改:隐藏意见列右侧边框 -->
<td class="no-right-border" colspan="2"><span t-esc="log.comment or ''"/></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') or ''"/>
</t>
</td>
</tr>
</t>
</table>
</t>
</t>
</t>
</template>
</odoo>