From e9bb4452bfc1390978203d31a6d9dbaa19d6b859 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: Tue, 22 Sep 2026 18:48:15 +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
---
.../models/property_accounts_receivable.py | 19 +++++++++
.../views/inherit_yuthon_property_views.xml | 34 ++-------------
.../views/receivable_type_menus.xml | 42 +++++++++++++++----
3 files changed, 58 insertions(+), 37 deletions(-)
diff --git a/yuthon_property/models/property_accounts_receivable.py b/yuthon_property/models/property_accounts_receivable.py
index 49a5f0e5b..854f8b4c3 100644
--- a/yuthon_property/models/property_accounts_receivable.py
+++ b/yuthon_property/models/property_accounts_receivable.py
@@ -60,6 +60,11 @@ class PropertyAccountsReceivable(models.Model):
has_date = fields.Date(string='退款日期')
delivered = fields.Boolean()
submitted = fields.Float(string='未收', compute='compute_submitted', store=True)
+ # 欠费月数 = 当前日期 - 应收开始日期(按整月计,未到期为 0);不落库,随算随出
+ overdue_months = fields.Integer(string='欠费月数', compute='_compute_overdue_months',
+ help='当前日期 - 应收开始日期,按整月计算;未到期为 0')
+ # 列表徽章展示用,形如「47 个月」
+ overdue_months_display = fields.Char(string='欠费月数', compute='_compute_overdue_months')
is_invalid = fields.Boolean(string='作废')
void_date = fields.Date(string='作废日期')
is_red = fields.Boolean(string='红冲')
@@ -278,6 +283,20 @@ class PropertyAccountsReceivable(models.Model):
else:
record.submitted = 0
+ @api.depends('due_date')
+ def _compute_overdue_months(self):
+ today = fields.Date.context_today(self)
+ for record in self:
+ months = 0
+ if record.due_date:
+ delta = relativedelta(today, record.due_date)
+ months = delta.years * 12 + delta.months
+ if months < 0:
+ months = 0
+ record.overdue_months = months
+ # 未到期(0)时留空,列表里的徽章自动隐藏
+ record.overdue_months_display = ('%s 个月' % months) if months > 0 else ''
+
def initialize_wizard(self):
return {
'name': '应收账单初始化数据弹窗',
diff --git a/yuthon_property_approval/views/inherit_yuthon_property_views.xml b/yuthon_property_approval/views/inherit_yuthon_property_views.xml
index 164fb8403..edfe4700f 100644
--- a/yuthon_property_approval/views/inherit_yuthon_property_views.xml
+++ b/yuthon_property_approval/views/inherit_yuthon_property_views.xml
@@ -511,40 +511,14 @@
property.accounts.receivable.tree.contract
property.accounts.receivable
+ primary
+
due_date desc
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/yuthon_work_brand/views/receivable_type_menus.xml b/yuthon_work_brand/views/receivable_type_menus.xml
index f79de0b7d..f8814f4bc 100644
--- a/yuthon_work_brand/views/receivable_type_menus.xml
+++ b/yuthon_work_brand/views/receivable_type_menus.xml
@@ -94,15 +94,43 @@
作用:类型专属菜单里已经用 domain 限定了类型,列表里不再显示「应收类型」列
说明:mode=primary 使其成为独立视图,不影响「应收账单汇总」等原有菜单的视图
-->
+
property.accounts.receivable.tree.no.type
property.accounts.receivable
-
+
primary
-
- 1
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
@@ -292,8 +320,8 @@
{'group_by': 'management_type_id', 'orderedBy': [{'name': 'due_date', 'asc': False}], 'searchpanel_default_deposit_state': 'unpaid'}
-
-
+
+