diff --git a/yuthon_property/models/property_accounts_receivable.py b/yuthon_property/models/property_accounts_receivable.py index b6c996885..b4a95d796 100644 --- a/yuthon_property/models/property_accounts_receivable.py +++ b/yuthon_property/models/property_accounts_receivable.py @@ -39,6 +39,7 @@ class PropertyAccountsReceivable(models.Model): management_type_id = fields.Many2one('yuthon.management.type', string='应收类型') last_update_time = fields.Datetime(string='最后修改时间') is_write = fields.Boolean(string='是否修改') + acc_type = fields.Selection([('new', '新租'), ('done', '到期')], string='类型') bank_id = fields.Many2one('property.bank.statements', string='流水记录') receivable_log = fields.Text(string='应收日志') diff --git a/yuthon_property/views/property_accounts_receivable_views.xml b/yuthon_property/views/property_accounts_receivable_views.xml index fe6e76cd3..9cf1a7a94 100644 --- a/yuthon_property/views/property_accounts_receivable_views.xml +++ b/yuthon_property/views/property_accounts_receivable_views.xml @@ -4,6 +4,7 @@ property.accounts.receivable + diff --git a/yuthon_property_approval/models/inherit_yuthon_property.py b/yuthon_property_approval/models/inherit_yuthon_property.py index bbf43ade2..baa9387f1 100644 --- a/yuthon_property_approval/models/inherit_yuthon_property.py +++ b/yuthon_property_approval/models/inherit_yuthon_property.py @@ -879,6 +879,17 @@ class PropertyRentList(models.Model): due_date_end = False theoretical_end = False contract = rec.contract_id + + existing_receivable = self.env['property.accounts.receivable'].search([ + ('lessee_id', '=', rec.lessee_id.id), + ('management_type_id.name', '=', '租金'), + ('contract_id', '=', contract), + ], limit=1) + if not existing_receivable: + acc_type = 'new' + else: + acc_type = None + if contract and contract.cycle_mode and due_date: due_date_obj = fields.Date.from_string(due_date) contract_actual_end = fields.Date.from_string( @@ -916,6 +927,7 @@ class PropertyRentList(models.Model): 'lessee_id': contract.lessee_id.id if contract and contract.lessee_id else None, 'original_amount': rec.original_amount, 'due_date': due_date, + 'acc_type': acc_type, 'due_date_end': due_date_end, 'create_time': datetime.now(), 'management_type_id': management_type.id, diff --git a/yuthon_property_approval/wizard/property_rental_wizard.py b/yuthon_property_approval/wizard/property_rental_wizard.py index d938842d0..3dddc3a54 100644 --- a/yuthon_property_approval/wizard/property_rental_wizard.py +++ b/yuthon_property_approval/wizard/property_rental_wizard.py @@ -163,7 +163,8 @@ class PropertyRentalWizard(models.Model): # 当期应收日期 if not record.is_contract: if start_year_month <= date_field_year_month <= end_year_month: - self.create_rent_list(record, rent_id, rent_amount, start_date, multiplier) + if rent_id.period_rent != 0: + self.create_rent_list(record, rent_id, rent_amount, start_date, multiplier) self.create_management_list(record, start_date, rent_amount) def get_multiplier(self, cycle_dict):