打印,字段修复

This commit is contained in:
李鹏宇
2026-05-28 16:29:14 +08:00
parent 8a8af5db25
commit 9488933341
6 changed files with 141 additions and 2 deletions
+7 -1
View File
@@ -141,12 +141,18 @@ class IssueLibrary(models.Model):
records = self.env['issue.library'].browse(active_ids)
count = 0
for record in records:
# 只清理party_char的HTML标签
# 清理party_char的HTML标签
if record.party_char:
clean_value = re.sub(r'<[^>]+>', '', record.party_char)
if clean_value != record.party_char:
record.party_char = clean_value
count += 1
# 清理class_char的HTML标签
if record.class_char:
clean_value = re.sub(r'<[^>]+>', '', record.class_char)
if clean_value != record.class_char:
record.class_char = clean_value
count += 1
return {
'type': 'ir.actions.client',
'tag': 'display_notification',
+3 -1
View File
@@ -115,7 +115,9 @@
'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'
'report/property_supervising_approval_print_templates.xml',
'report/property_open_rent_print_report.xml',
'report/property_open_rent_print_templates.xml'
],
@@ -271,6 +271,13 @@ class PropertyOpenRent(models.Model):
name_title = fields.Char(default=_get_default_name_title)
self_users_ids = fields.Many2many('res.users', string="当前经办人", default=lambda self: [(6, 0, [self.env.user.id])])
def action_print_property_open_rent(self):
"""打印公开招租审批"""
self.ensure_one()
report_ref = self.env.ref('yuthon_property_approval.action_property_open_rent_print_report')
return report_ref.sudo().report_action(self)
#
#
# class PropertyOpenRentLine(models.Model):
@@ -0,0 +1,24 @@
<?xml version="1.0" encoding="UTF-8"?>
<odoo>
<data>
<!-- 公开招租审批打印报表 -->
<record id="paperformat_property_open_rent_small" model="report.paperformat">
<field name="name">Open Rent Small Top Margin</field>
<field name="format">A4</field>
<field name="margin_top">5</field>
<field name="orientation">Portrait</field>
</record>
<record id="action_property_open_rent_print_report" model="ir.actions.report">
<field name="name">公开招租审批</field>
<field name="paperformat_id" ref="yuthon_property_approval.paperformat_property_open_rent_small"/>
<field name="model">property.open.rent</field>
<field name="report_type">qweb-pdf</field>
<field name="report_name">yuthon_property_approval.property_open_rent_print_template</field>
<field name="report_file">yuthon_property_approval.property_open_rent_print_template</field>
<field name="print_report_name">'公开招租审批%s_%s_%s' % (object.display_name or object.code or '', object.user_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_open_rent"/>
<field name="binding_type">report</field>
</record>
</data>
</odoo>
@@ -0,0 +1,94 @@
<?xml version="1.0" encoding="UTF-8"?>
<odoo>
<template id="property_open_rent_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: middle; }
.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; }
.text-center { text-align: center !important; }
.no-right-border { border-right: none !important; }
.no-left-border { border-left: none !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.user_id.name or ''"/></td>
</tr>
<tr>
<td class="label">紧急度</td>
<td><span t-esc="dict(doc._fields['urgency_level'].selection).get(doc.urgency_level, '')"/></td>
<td class="label">是否用章</td>
<td><span t-esc="dict(doc._fields['is_chapter'].selection).get(doc.is_chapter, '')"/></td>
</tr>
<tr>
<td class="label">经办意见</td>
<td colspan="3"><span t-esc="doc.handling_opinions or ''"/></td>
</tr>
</table>
<!-- 租赁期限 -->
<div class="section">租赁期限</div>
<table class="po">
<tr>
<td class="label" width="20%">租期</td>
<td width="30%"><span t-esc="str(doc.lease_term_year) + '年' + str(doc.lease_term_month) + '月' + str(doc.lease_term_day) + '日'"/></td>
<td class="label" width="20%">总面积 (㎡)</td>
<td width="30%"><span t-esc="'%.4f' % (doc.total_area or 0.0)"/></td>
</tr>
<tr>
<td class="label">月租金 (元)</td>
<td><span t-esc="'%.2f' % (doc.rent or 0.0)"/></td>
<td class="label">单价 (元/㎡)</td>
<td width="30%"><span t-esc="'%.4f' % (doc.unit_price or 0.0)"/></td>
</tr>
<tr>
<td class="label">总租金 (元)</td>
<td colspan="3"><span t-esc="'%.2f' % (doc.total_rent or 0.0)"/></td>
</tr>
</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 class="no-right-border" width="50%"><span t-esc="log.comment or ''"/></td>
<td class="no-left-border" width="35%">
<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 (log.date_create and log.date_create.strftime('%Y-%m-%d') or '')"/>
</t>
</td>
</tr>
</t>
</table>
</div>
</div>
</t>
</t>
</t>
</template>
</odoo>
@@ -16,6 +16,12 @@
<field name="model">property.open.rent</field>
<field name="arch" type="xml">
<form string="物业公开招租" create="0">
<header>
<button name="action_print_property_open_rent"
type="object"
string="打印"
class="btn-primary"/>
</header>
<sheet>
<group col="3">
<group>