Merge pull request !3431 from 李鹏宇/dev
This commit is contained in:
李鹏宇
2025-06-20 12:24:45 +00:00
committed by Gitee
2 changed files with 23 additions and 0 deletions
@@ -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
@@ -857,6 +857,13 @@
<field name="state">code</field>
<field name="code">action = model.action_update_contract()</field>
</record>
<record id="all_data_action_update_rent" model="ir.actions.server">
<field name="name">更新租金明细</field>
<field name="model_id" ref="yuthon_property_approval.model_property_lease_contract"/>
<field name="binding_model_id" ref="yuthon_property_approval.model_property_lease_contract"/>
<field name="state">code</field>
<field name="code">action = model.all_action_generate_details()</field>
</record>
<record id="all_data_action_update_time" model="ir.actions.server">
<field name="name">更新时间</field>
<field name="model_id" ref="yuthon_property_approval.model_property_lease_contract"/>