diff --git a/yuthon_property_approval/models/property_lease_contract.py b/yuthon_property_approval/models/property_lease_contract.py
index 09ef6712c..b821cb539 100644
--- a/yuthon_property_approval/models/property_lease_contract.py
+++ b/yuthon_property_approval/models/property_lease_contract.py
@@ -488,6 +488,22 @@ class PropertyLeaseContract(models.Model):
all_period_rent = record.do_generate_details_core(start_date, first_year_end_date, False)
record.first_year_rent = all_period_rent
+ def all_action_generate_details(self):
+ property_ids = self.env["property.lease.contract"].browse(
+ self._context.get('active_ids', self._context.get('active_id')))
+ for record in property_ids:
+ if record.term_start_time and record.term_end_time:
+ record.write({'breakdown_ids': [(5, 0, 0)]})
+ start_date = record.term_start_time
+ end_date = record.term_end_time + relativedelta(days=1)
+ record.do_generate_details_core(start_date, end_date, True)
+ # 计算首年租金
+ first_year_end_date = start_date + relativedelta(months=12)
+ if first_year_end_date > end_date:
+ first_year_end_date = end_date
+ all_period_rent = record.do_generate_details_core(start_date, first_year_end_date, False)
+ record.first_year_rent = all_period_rent
+
def do_generate_details_core(self, start_date, end_date, write_db=False):
all_period_rent = 0
diff --git a/yuthon_property_approval/views/property_lease_contract.xml b/yuthon_property_approval/views/property_lease_contract.xml
index 3de445966..df596aa31 100644
--- a/yuthon_property_approval/views/property_lease_contract.xml
+++ b/yuthon_property_approval/views/property_lease_contract.xml
@@ -857,6 +857,13 @@
code
action = model.action_update_contract()
+
+ 更新租金明细
+
+
+ code
+ action = model.all_action_generate_details()
+
更新时间