From 3044d693619ace3b72fb8c77c8dcd945f2dce543 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=8E=E9=B9=8F=E5=AE=87?= Date: Thu, 5 Mar 2026 11:54:00 +0800 Subject: [PATCH] =?UTF-8?q?=E7=A7=9F=E8=B5=81=E5=8F=98=E6=9B=B4=E6=B5=81?= =?UTF-8?q?=E7=A8=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../models/property_lease_renewal.py | 21 +++++++++++++++++-- 1 file changed, 19 insertions(+), 2 deletions(-) diff --git a/yuthon_property_approval/models/property_lease_renewal.py b/yuthon_property_approval/models/property_lease_renewal.py index 04f8c5bc7..fb3829dab 100644 --- a/yuthon_property_approval/models/property_lease_renewal.py +++ b/yuthon_property_approval/models/property_lease_renewal.py @@ -88,7 +88,24 @@ class PropertyLeaseRenewal(models.Model): def end_approval(self): for rec in self: - if rec.renewal_type == 'lease': + if rec.renewal_type == 'extend': + # 延长租期:修改原合同实际结束日期,并将租金明细写入原合同 + if rec.actual_end_date: + rec.contract_id.write({ + 'actual_end_time': rec.actual_end_date + }) + if rec.breakdown_ids: + for line in rec.breakdown_ids: + self.env['property.rent.breakdown.line'].create({ + 'breakdown_id': rec.contract_id.id, + 'unit_price': line.unit_price, + 'monthly_amount': line.monthly_amount, + 'start_data': line.start_data, + 'end_data': line.end_data, + 'month_number': line.month_number, + 'period_rent': line.period_rent, + }) + elif rec.renewal_type == 'lease': origin_contract = rec.contract_id contract_actual_end = origin_contract.actual_end_time if origin_contract else None @@ -141,7 +158,7 @@ class PropertyLeaseRenewal(models.Model): 'management_type_id': management_type_id.id, 'due_date': rec.effective_date, }) - else: + elif rec.renewal_type == 'early_checkout': rec.contract_id.write({ 'actual_end_time': rec.early_quitting_date })