From de53aa361bf85276be2c64e5a63f5ca339e4ac1a 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: Mon, 24 Aug 2026 19:45:03 +0800 Subject: [PATCH] =?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 | 11 ++------ .../wizard/penalty_line_wizard.py | 25 ++----------------- 2 files changed, 4 insertions(+), 32 deletions(-) diff --git a/yuthon_property/models/property_accounts_receivable.py b/yuthon_property/models/property_accounts_receivable.py index b1040c87b..eb0ff82c3 100644 --- a/yuthon_property/models/property_accounts_receivable.py +++ b/yuthon_property/models/property_accounts_receivable.py @@ -267,17 +267,10 @@ class PropertyAccountsReceivable(models.Model): rent_pay_count = len(modify_lines.filtered(lambda l: not l.is_penalty)) penalty_pay_count = len(penalty_lines.filtered(lambda l: l.is_penalty)) - deposit_penalty_count = 0 - if renewal: - if renewal.deposit_treatment != 'refund': - penalty_amount = renewal.deposit - renewal.refund_amount - renewal.total_receivables - if penalty_amount > 0: - deposit_penalty_count = 1 - if record.management_type_id.name == '押金': - record.number_of_payments = rent_pay_count + deposit_penalty_count + record.number_of_payments = rent_pay_count else: - record.number_of_payments = rent_pay_count + penalty_pay_count + record.number_of_payments = penalty_pay_count @api.depends('original_amount', 'delivered1', 'discount_amount') def compute_submitted(self): diff --git a/yuthon_property_approval/wizard/penalty_line_wizard.py b/yuthon_property_approval/wizard/penalty_line_wizard.py index 385e560da..5c0858122 100644 --- a/yuthon_property_approval/wizard/penalty_line_wizard.py +++ b/yuthon_property_approval/wizard/penalty_line_wizard.py @@ -164,34 +164,13 @@ class PenaltyLineWizard(models.Model): })) contract = receivable.contract_id - if contract and receivable.management_type_id.name == '押金': - # 1. 查找 合同对应的 提前退租 续约单 - renewal = self.env['property.lease.renewal'].search([ - ('contract_id', '=', contract.id), - ('renewal_type', '=', 'early_checkout'), - ('work_end', '=', True), - ], limit=1) - if renewal: - # 2. 判断条件:未全额退款 - if renewal.deposit_treatment != 'refund': - # 3. 计算没收押金金额 - penalty_amount = renewal.deposit - renewal.refund_amount - renewal.total_receivables - if penalty_amount > 0: - # 4. 日期 = 提前退租日期 - penalty_date = renewal.early_quitting_date - new_pay_lines.append((0, 0, { - 'date': penalty_date, - 'amount': -self.receivable_id.delivered1, - 'management_type_id': deposit_type.id if deposit_type else False, - 'remake': '没收押金', - })) # 关联应付账单 bills_id = self.env['property.bills.list'].search([('contract_id', '=', contract.id)]) for bill in bills_id: - if bill.actual_date: + if bill.actual_date and bill.management_type_id == receivable.management_type_id: new_pay_lines.append((0, 0, { 'date': bill.actual_date, - 'amount': bill.amount_actual, + 'amount': -bill.amount_actual, 'management_type_id': bill.management_type_id.id, 'remake': bill.remake, }))