From 66ee0fd7786b779d02d9baff153ff6c29e6eba39 Mon Sep 17 00:00:00 2001
From: zhou <123@>
Date: Sun, 1 Jun 2025 18:55:49 +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
---
excel_report_designer/models/report_excel.py | 2 +-
.../models/property_management.py | 54 ++++++++++++-------
.../views/property_management.xml | 12 ++---
.../wizard/property_management_wizard.xml | 2 +-
4 files changed, 44 insertions(+), 26 deletions(-)
diff --git a/excel_report_designer/models/report_excel.py b/excel_report_designer/models/report_excel.py
index aeddbbe2c..a8b4bc434 100644
--- a/excel_report_designer/models/report_excel.py
+++ b/excel_report_designer/models/report_excel.py
@@ -778,6 +778,6 @@ class ReportExcel(models.Model):
target_name = f"{current_year}年-{chinese_month}"
return [
('is_salary_push', '=', True),
- ('is_salary_release', '=', True),
+ ('is_salary_release', '=', False),
('payslip_run_id.name', '=', target_name)
]
diff --git a/yuthon_property_approval/models/property_management.py b/yuthon_property_approval/models/property_management.py
index 504cf5045..4204f6cfa 100644
--- a/yuthon_property_approval/models/property_management.py
+++ b/yuthon_property_approval/models/property_management.py
@@ -72,26 +72,44 @@ class PropertyManagement(models.Model):
def approval_end(self):
for record in self:
for line in record.management_line2_ids:
- line.property_id.write({
- 'company_id': record.company_id.id,
- 'precinct_id': record.precinct_id.id,
- 'admin_id': record.admin_id_all.id,
- 'tenure_type': record.tenure_type,
- 'purpose_id': record.purpose_id.id,
- })
- line.information_line_id.write({'end_date': fields.Date.today()})
- self.env['manage.information.line'].create({
+ # 准备要更新的字段值,只包含存在的值
+ property_values = {}
+ if record.company_id:
+ property_values['company_id'] = record.company_id.id
+ if record.precinct_id:
+ property_values['precinct_id'] = record.precinct_id.id
+ if record.admin_id_all:
+ property_values['admin_id'] = record.admin_id_all.id
+ if record.tenure_type:
+ property_values['tenure_type'] = record.tenure_type
+ if record.purpose_id:
+ property_values['purpose_id'] = record.purpose_id.id
+ # 更新物业记录
+ if property_values:
+ line.property_id.write(property_values)
+ # 更新信息行的结束日期
+ if line.information_line_id:
+ line.information_line_id.write({'end_date': fields.Date.today()})
+
+ # 直接从关联的上一条记录获取值(如果存在)
+ prev_info = line.information_line_id
+
+ # 创建新的信息行记录,从prev_info获取缺失的值
+ info_line_vals = {
'yuthon_property_id': line.property_id.id,
- 'purpose_id' : record.purpose_id.id,
- 'precinct_id': record.precinct_id.id,
- 'tenure_type': record.tenure_type,
- 'management_area': line.information_line_id.management_area,
- 'rent_area': line.information_line_id.rent_area,
- 'admin_id' : record.admin_id_all.id,
- 'company_id': record.company_id.id,
+ 'purpose_id': record.purpose_id.id if record.purpose_id else prev_info.purpose_id.id,
+ 'precinct_id': record.precinct_id.id if record.precinct_id else prev_info.precinct_id.id,
+ 'tenure_type': record.tenure_type or prev_info.tenure_type,
+ 'management_area': prev_info.management_area if prev_info else 0.0,
+ 'rent_area': prev_info.rent_area if prev_info else 0.0,
+ 'admin_id': record.admin_id_all.id if record.admin_id_all else prev_info.admin_id.id,
+ 'company_id': record.company_id.id if record.company_id else prev_info.company_id.id if prev_info else False,
'start_time': fields.Date.today(),
- })
- record.write({'is_line': True})
+ }
+
+ # 创建新记录
+ self.env['manage.information.line'].create(info_line_vals)
+ record.write({'is_line': True})
def put_property_management(self):
return {
diff --git a/yuthon_property_approval/views/property_management.xml b/yuthon_property_approval/views/property_management.xml
index b528049da..9945027f5 100644
--- a/yuthon_property_approval/views/property_management.xml
+++ b/yuthon_property_approval/views/property_management.xml
@@ -62,7 +62,7 @@
-
+
@@ -93,19 +93,19 @@
-
+
-
+
-
+
-
+
-
+
diff --git a/yuthon_property_approval/wizard/property_management_wizard.xml b/yuthon_property_approval/wizard/property_management_wizard.xml
index a24af5528..51d741812 100644
--- a/yuthon_property_approval/wizard/property_management_wizard.xml
+++ b/yuthon_property_approval/wizard/property_management_wizard.xml
@@ -8,7 +8,7 @@
-
+