diff --git a/yuthon_property_approval/models/property_lease_contract.py b/yuthon_property_approval/models/property_lease_contract.py index 019f897d1..f3260cdce 100644 --- a/yuthon_property_approval/models/property_lease_contract.py +++ b/yuthon_property_approval/models/property_lease_contract.py @@ -301,13 +301,12 @@ class PropertyLeaseContract(models.Model): is_issues = fields.Boolean(string='是否上会') issues_result = fields.Html(string="会议结果") related_issues_id = fields.Many2one('issue.library', string="关联议题") + chu_fa = fields.Boolean(string="", compute='action_view_contract') - @api.model - def get_view(self, view_id=None, view_type='form', **options): - res = super(PropertyLeaseContract, self).get_view(view_id=view_id, view_type=view_type, **options) - if view_type == 'form' and self._context.get('active_id'): - # 获取当前选中的主模型记录 - record = self.browse(self._context.get('active_id')) + @api.depends('contract_code') + def action_view_contract(self): + self.ensure_one() + for record in self: total_month_number = 0 if record.term_start_time and record.term_end_time: delta = relativedelta(record.term_end_time, record.term_start_time) @@ -342,7 +341,7 @@ class PropertyLeaseContract(models.Model): 'management_month_number': total_month_number, }) - return res + record.chu_fa = True @api.onchange('is_issues') def _onchange_is_issues(self): @@ -1866,6 +1865,7 @@ class PropertyLeaseContract(models.Model): new_contract.write({ 'admin_id': original_contract.admin_id, 'contract_code': None, + 'work_end': False, 'lease_term_year': None, 'term_start_time': new_term_start, 'term_end_time': None, diff --git a/yuthon_property_approval/views/property_lease_contract.xml b/yuthon_property_approval/views/property_lease_contract.xml index da02d9ae3..8e4d4041d 100644 --- a/yuthon_property_approval/views/property_lease_contract.xml +++ b/yuthon_property_approval/views/property_lease_contract.xml @@ -476,6 +476,7 @@ + @@ -746,7 +747,7 @@ - + @@ -759,7 +760,7 @@ - + diff --git a/yuthon_property_approval/wizard/property_rental_wizard.py b/yuthon_property_approval/wizard/property_rental_wizard.py index 365c33bf2..2bd28fbdf 100644 --- a/yuthon_property_approval/wizard/property_rental_wizard.py +++ b/yuthon_property_approval/wizard/property_rental_wizard.py @@ -118,7 +118,6 @@ class PropertyRentalWizard(models.Model): b.end_data >= first_day_of_month ) original_amount = matched_breakdowns.management_monthly_amount - else: original_amount = rent_amount