From cdee1821955394440b1b73724fb53632e6e996ca Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=E6=9D=8E=E9=B9=8F=E5=AE=87?=
<9664676+pengyuthon@user.noreply.gitee.com>
Date: Mon, 21 Sep 2026 17:14:22 +0800
Subject: [PATCH] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E5=8A=9F=E8=83=BD?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
.../data/property_tenant_checkout_data.xml | 32 ++++++
.../models/property_tenant_checkout.py | 39 +++++++-
.../property_tenant_checkout_inspection.py | 14 ++-
.../property_tenant_checkout_template.xml | 2 +-
.../security/ir.model.access.csv | 1 +
.../views/property_tenant_checkout_views.xml | 98 +++++++------------
.../views/receivable_type_menus.xml | 32 +++---
7 files changed, 134 insertions(+), 84 deletions(-)
diff --git a/yuthon_property_approval/data/property_tenant_checkout_data.xml b/yuthon_property_approval/data/property_tenant_checkout_data.xml
index b29cc14b8..a107f0a81 100644
--- a/yuthon_property_approval/data/property_tenant_checkout_data.xml
+++ b/yuthon_property_approval/data/property_tenant_checkout_data.xml
@@ -8,4 +8,36 @@
3
+
+
+
+
+ 空调机
+ 10
+
+
+ 水管
+ 20
+
+
+ 光管(照明)
+ 30
+
+
+ 室内装修
+ 40
+
+
+ 其它设备
+ 50
+
+
+ 收回钥匙
+ 60
+
+
+ 电表
+ 70
+
+
diff --git a/yuthon_property_approval/models/property_tenant_checkout.py b/yuthon_property_approval/models/property_tenant_checkout.py
index f36b8da07..35337f347 100644
--- a/yuthon_property_approval/models/property_tenant_checkout.py
+++ b/yuthon_property_approval/models/property_tenant_checkout.py
@@ -72,7 +72,7 @@ class PropertyTenantCheckout(models.Model):
# ===== 节点四:费用结算与复核 =====
fee_ids = fields.One2many('property.tenant.checkout.fee', 'checkout_id', string='应收费用明细') # 应收费用明细
- total_fee = fields.Float(string='应收合计', compute='_compute_total_fee', store=True) # 应收费用合计(自动求和)
+ total_fee = fields.Float(string='应收合计', compute='_compute_total_fee', store=True) # 应收明细(未对账且未作废)金额-减免-退款合计
deposit_treatment = fields.Selection([
('refund', '全额退押'), ('part_refund', '部分退租'), ('no_refund', '全额没收')
], string='保证金处理方式') # 保证金处理方式(与租赁变更审批·合同终止逻辑一致)
@@ -91,11 +91,42 @@ class PropertyTenantCheckout(models.Model):
total_receivables = fields.Float(string='应收金额', compute='_compute_total_receivables', store=True) # 应收金额(部分退押时汇总)
receivables_ids = fields.One2many('early.receivables.line', 'checkout_id', string='应收明细') # 截至退租日的应收账单(可作废/减免/退款)
- @api.depends('fee_ids', 'fee_ids.amount')
+ # ===== 工程组检查项:默认带出字典中的检查项 =====
+ def _default_inspection_lines(self):
+ """按检查项字典(有效项、按序号)生成明细行命令,供 default_get / create 自动带出"""
+ items = self.env['property.checkout.inspection.item'].search([('active', '=', True)])
+ return [(0, 0, {
+ 'item_id': item.id,
+ 'sequence': item.sequence,
+ 'status': 'normal',
+ }) for item in items]
+
+ @api.model
+ def default_get(self, fields_list):
+ """新建表单时即带出检查项默认行(未保存也可在表单上看到)"""
+ res = super().default_get(fields_list)
+ if 'inspection_ids' in fields_list and not res.get('inspection_ids'):
+ res['inspection_ids'] = self._default_inspection_lines()
+ return res
+
+ @api.model_create_multi
+ def create(self, vals_list):
+ """程序化创建(如合同列表点「退租」发起)时,自动补齐检查项默认行"""
+ for vals in vals_list:
+ if 'inspection_ids' not in vals:
+ vals['inspection_ids'] = self._default_inspection_lines()
+ return super().create(vals_list)
+
+ @api.depends('receivables_ids', 'receivables_ids.original_amount', 'receivables_ids.reduction_amount',
+ 'receivables_ids.refund_amount', 'receivables_ids.void', 'receivables_ids.is_reconciliation')
def _compute_total_fee(self):
- """应收合计 = 所有费用明细金额之和"""
+ """应收合计 = 应收明细中「未对账且未作废」的(金额 - 减免金额 - 退款金额)之和"""
for rec in self:
- rec.total_fee = sum(line.amount for line in rec.fee_ids)
+ rec.total_fee = sum(
+ line.original_amount - line.reduction_amount - line.refund_amount
+ for line in rec.receivables_ids
+ if not line.void and not line.is_reconciliation
+ )
@api.onchange('tenant_signature')
def _onchange_tenant_signature(self):
diff --git a/yuthon_property_approval/models/property_tenant_checkout_inspection.py b/yuthon_property_approval/models/property_tenant_checkout_inspection.py
index e036ee2da..7a26a2e04 100644
--- a/yuthon_property_approval/models/property_tenant_checkout_inspection.py
+++ b/yuthon_property_approval/models/property_tenant_checkout_inspection.py
@@ -4,6 +4,17 @@
from odoo import models, fields
+class PropertyCheckoutInspectionItem(models.Model):
+ """退租检查项字典(物业检查项明细行的「检查项」many2one 来源)"""
+ _name = 'property.checkout.inspection.item'
+ _description = '退租检查项'
+ _order = 'sequence, id'
+
+ name = fields.Char(string='检查项名称', required=True)
+ sequence = fields.Integer(string='序号', default=10)
+ active = fields.Boolean(string='有效', default=True)
+
+
class PropertyTenantCheckoutInspection(models.Model):
"""租户退租表-物业检查项(工程组检查阶段的可增删明细行)"""
_name = 'property.tenant.checkout.inspection'
@@ -12,7 +23,8 @@ class PropertyTenantCheckoutInspection(models.Model):
checkout_id = fields.Many2one('property.tenant.checkout', string='退租表', ondelete='cascade') # 关联退租表
sequence = fields.Integer(string='序号', default=10) # 排序
- item = fields.Char(string='检查项') # 检查项名称
+ item_id = fields.Many2one('property.checkout.inspection.item', string='检查项') # 检查项(字典)
+ item_name = fields.Char(related='item_id.name', string='检查项名称') # 冗余名称(报表展示用)
status = fields.Selection([('normal', '正常'), ('abnormal', '异常')], string='状态', default='normal') # 正常/异常
note = fields.Text(string='批注') # 批注说明
repair_fee = fields.Float(string='维修费') # 维修费金额
diff --git a/yuthon_property_approval/report/property_tenant_checkout_template.xml b/yuthon_property_approval/report/property_tenant_checkout_template.xml
index a241677e4..6d7513a6c 100644
--- a/yuthon_property_approval/report/property_tenant_checkout_template.xml
+++ b/yuthon_property_approval/report/property_tenant_checkout_template.xml
@@ -100,7 +100,7 @@
- |
+ |
|
|
|
diff --git a/yuthon_property_approval/security/ir.model.access.csv b/yuthon_property_approval/security/ir.model.access.csv
index 4acbf4b72..c12609b8c 100644
--- a/yuthon_property_approval/security/ir.model.access.csv
+++ b/yuthon_property_approval/security/ir.model.access.csv
@@ -150,3 +150,4 @@ access_property_tenant_checkout,property_tenant_checkout,model_property_tenant_c
access_property_tenant_checkout_inspection,property_tenant_checkout_inspection,model_property_tenant_checkout_inspection,base.group_user,1,1,1,1
access_property_tenant_checkout_fee,property_tenant_checkout_fee,model_property_tenant_checkout_fee,base.group_user,1,1,1,1
access_property_accounts_receivable_summary,property_accounts_receivable_summary,model_property_accounts_receivable_summary,base.group_user,1,0,0,0
+access_property_checkout_inspection_item,property_checkout_inspection_item,model_property_checkout_inspection_item,base.group_user,1,1,1,1
diff --git a/yuthon_property_approval/views/property_tenant_checkout_views.xml b/yuthon_property_approval/views/property_tenant_checkout_views.xml
index 439e2b025..2ce33dde9 100644
--- a/yuthon_property_approval/views/property_tenant_checkout_views.xml
+++ b/yuthon_property_approval/views/property_tenant_checkout_views.xml
@@ -77,16 +77,9 @@
-
+
-
-
-
-
-
-
-
@@ -94,85 +87,45 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
-
+
-
+
-
-
-
-
-
-
-
-
-
+
-
+
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
@@ -203,6 +156,25 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/yuthon_work_brand/views/receivable_type_menus.xml b/yuthon_work_brand/views/receivable_type_menus.xml
index e2f3f76db..1aff11c65 100644
--- a/yuthon_work_brand/views/receivable_type_menus.xml
+++ b/yuthon_work_brand/views/receivable_type_menus.xml
@@ -251,16 +251,16 @@
action="action_receivable_type_deposit"
sequence="6"/>
-
-
+
+
- 广告灯箱费
+ 灯箱
property.accounts.receivable
tree
-
- [('management_type_id.name', '=', '广告灯箱费')]
+
+ [('management_type_id.name', '=', '灯箱')]
{'orderedBy': [{'name': 'due_date', 'asc': False}], 'searchpanel_default_deposit_state': 'unpaid'}
@@ -268,26 +268,26 @@
-
-
+
- 其它
+ 其他
property.accounts.receivable
tree
- [('management_type_id.name', 'in', ['有偿服务收入', '停车费', '灯箱', '管子间', '更名费', '维修费', '其他费用', '评估费', '保险费'])]
+ [('management_type_id.name', 'in', ['广告灯箱费', '有偿服务收入', '停车费', '管子间', '更名费', '维修费', '其他费用', '评估费', '保险费'])]
{'group_by': 'management_type_id', 'orderedBy': [{'name': 'due_date', 'asc': False}], 'searchpanel_default_deposit_state': 'unpaid'}
@@ -296,7 +296,7 @@
@@ -310,7 +310,7 @@
-->
-
+
@@ -319,13 +319,15 @@
-
+
+
+