From f52438b0e8ba4efed5040afbd6391df33ec55334 Mon Sep 17 00:00:00 2001 From: ljmwkx <1340053001@qq.com> Date: Tue, 7 Jan 2025 17:07:10 +0800 Subject: [PATCH] 1 --- .../models/property_lease_contract.py | 23 +++++++++---------- 1 file changed, 11 insertions(+), 12 deletions(-) diff --git a/yuthon_property_approval/models/property_lease_contract.py b/yuthon_property_approval/models/property_lease_contract.py index df4ea0290..9f9d52d4f 100644 --- a/yuthon_property_approval/models/property_lease_contract.py +++ b/yuthon_property_approval/models/property_lease_contract.py @@ -344,16 +344,15 @@ class PropertyLeaseContract(models.Model): free_start = start_date # 免租期开始 if rent_free_period_month: free_start = start_date + relativedelta(months=rent_free_period_month) - - self.sudo().write({'breakdown_ids': [(0, 0, { - "unit_price": unit_price, - "monthly_amount": monthly_amount, - "breakdown_id": self.id, - "start_data": start_date, - "end_data": free_start - relativedelta(days=1), - "month_number": rent_free_period_month, - "period_rent": 0, - })]}) + self.sudo().write({'breakdown_ids': [(0, 0, { + "unit_price": unit_price, + "monthly_amount": monthly_amount, + "breakdown_id": self.id, + "start_data": start_date, + "end_data": free_start - relativedelta(days=1), + "month_number": rent_free_period_month, + "period_rent": 0, + })]}) # 如果没有递增 那么计算全部 if not increments_every_few_years: # 如果免租期有天那么默认增加一个月 @@ -393,9 +392,9 @@ class PropertyLeaseContract(models.Model): else: first_years_begin_end = start_date # 免递增年份计算 - if first_years_begin: + if first_years_begin > 1: # 免递增结束时间 - first_years_begin_end = start_date + relativedelta(months=first_years_begin * 12) + first_years_begin_end = start_date + relativedelta(months=(first_years_begin -1) * 12) # 免租期结束时间 free_start # 计算免租期和免增期的差值, 如果免租期超过免增期那么不存在免增期 if first_years_begin_end > free_start: