From b69dda7862459eff01ac1b182da0711f34a31a33 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=8E=E9=B9=8F=E5=AE=87?= <9664676+pengyuthon@user.noreply.gitee.com> Date: Fri, 17 Oct 2025 15:20:26 +0800 Subject: [PATCH 1/2] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E5=8A=9F=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../models/property_accounts_receivable.py | 1 + .../views/property_accounts_receivable_views.xml | 1 + .../models/inherit_yuthon_property.py | 12 ++++++++++++ .../wizard/property_rental_wizard.py | 3 ++- 4 files changed, 16 insertions(+), 1 deletion(-) 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): From 4aa0ecd11de0ca0234b944ea84d8c805e72282b3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=8E=E9=B9=8F=E5=AE=87?= <9664676+pengyuthon@user.noreply.gitee.com> Date: Fri, 17 Oct 2025 15:40:59 +0800 Subject: [PATCH 2/2] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E5=8A=9F=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../wizard/property_rental_wizard.py | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/yuthon_property_approval/wizard/property_rental_wizard.py b/yuthon_property_approval/wizard/property_rental_wizard.py index 3dddc3a54..8ff44aeca 100644 --- a/yuthon_property_approval/wizard/property_rental_wizard.py +++ b/yuthon_property_approval/wizard/property_rental_wizard.py @@ -99,13 +99,12 @@ class PropertyRentalWizard(models.Model): for lease_id in record.lease_ids: property_id = lease_id.address_id management_id = self.env['property.management.list'].search([ - ('property_id', '=', property_id.id), ('contract_id', '=', record.id), ('due_date', '>=', first_day_of_month), ('due_date', '<=', last_day_of_month) ]) matched_info = self.env['manage.information.line'] - if record.contract_sort in ['guanggao','guanzi']: + if record.contract_sort in ['guanggao','guanzi', 'room']: original_amount = rent_amount else: original_amount = 0 @@ -124,7 +123,7 @@ class PropertyRentalWizard(models.Model): if matched_info: original_amount = int(round(matched_info.management_area * standard_id.amount)) - is_special_contract = record.contract_sort in ['guanggao', 'guanzi'] + is_special_contract = record.contract_sort in ['guanggao', 'guanzi', 'room'] has_valid_property_info = property_id.manage_information_ids and property_id.message_standard_id if (not is_special_contract and has_valid_property_info) or is_special_contract: area_value = matched_info.management_area if matched_info else 0 @@ -163,7 +162,7 @@ class PropertyRentalWizard(models.Model): # 当期应收日期 if not record.is_contract: if start_year_month <= date_field_year_month <= end_year_month: - if rent_id.period_rent != 0: + if rent_id.period_rent != 0 and record.contract_sort not in ['guanggao', 'guanzi', 'room']: self.create_rent_list(record, rent_id, rent_amount, start_date, multiplier) self.create_management_list(record, start_date, rent_amount) @@ -184,8 +183,9 @@ class PropertyRentalWizard(models.Model): first_day = datetime.strptime(date_field_year_month, '%Y-%m').date() next_month_first_day = first_day + relativedelta(months=1) records = self.env['property.lease.contract'].search([ - ('actual_start_time', '<', next_month_first_day), - ('actual_end_time', '>=', first_day), + # ('actual_start_time', '<', next_month_first_day), + # ('actual_end_time', '>=', first_day), + ('contract_code', '=', '管(2025)001') ]) for record in records: # 获取租金乘数(1 表示按月,3 表示季租金,6 表示半年租金,年后面赋值)