Merge pull request !12720 from 李鹏宇/dev
This commit is contained in:
李鹏宇
2026-08-24 11:45:56 +00:00
committed by Gitee
2 changed files with 4 additions and 32 deletions
@@ -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):
@@ -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,
}))