From 2ec67831ff41a7d366f22c4cfcc5920bccef1eec 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: Thu, 26 Feb 2026 15:13:47 +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
---
yuthon_property/models/yuthon_property.py | 19 +++++++++++++++++++
.../views/yuthon_property_views.xml | 7 +++++++
2 files changed, 26 insertions(+)
diff --git a/yuthon_property/models/yuthon_property.py b/yuthon_property/models/yuthon_property.py
index 48052d77d..a79d1d3de 100644
--- a/yuthon_property/models/yuthon_property.py
+++ b/yuthon_property/models/yuthon_property.py
@@ -156,6 +156,25 @@ class YuthonProperty(models.Model):
for property_id in property_ids:
property_id.compute_is_new()
+ def update_message(self):
+ property_ids = self.env["yuthon.property"].browse(
+ self._context.get('active_ids', self._context.get('active_id')))
+ for property_rec in property_ids:
+ if not property_rec.manage_information_ids:
+ continue
+ date_groups = {}
+ for line in property_rec.manage_information_ids:
+ date_key = line.start_time or 'no_date'
+ if date_key not in date_groups:
+ date_groups[date_key] = []
+ date_groups[date_key].append(line.id)
+ ids_to_unlink = []
+ for date_key, line_ids in date_groups.items():
+ if len(line_ids) > 1:
+ ids_to_unlink.extend(line_ids[1:])
+ if ids_to_unlink:
+ self.env['manage.information.line'].browse(ids_to_unlink).unlink()
+
@api.depends('manage_information_ids', 'manage_information_ids.start_time',
'manage_information_ids.end_date', 'is_done_split')
def compute_is_new(self):
diff --git a/yuthon_property/views/yuthon_property_views.xml b/yuthon_property/views/yuthon_property_views.xml
index c81d7f92b..9635f43ae 100644
--- a/yuthon_property/views/yuthon_property_views.xml
+++ b/yuthon_property/views/yuthon_property_views.xml
@@ -476,6 +476,13 @@
code
action = model.trigger_company_id()
+
+
+ 一次性
+
+
+ code
+ action = model.update_message()
还原物业变更信息