!10021 !10019 Merge branch 'dev' of <a href="https://gitee.com/jinan-pengyuse…

Merge pull request !10021 from 李鹏宇/dev
This commit is contained in:
李鹏宇
2026-03-20 11:40:48 +00:00
committed by Gitee
@@ -55,27 +55,21 @@ class DepositPreReceivedReport(models.Model):
rows = []
total_amount = 0.0
idx = 1
# 用于去重,同一应收账单关联的 wizard 只处理一次
processed_receivable_ids = set()
for line in modify_lines:
if not line.receivable_id:
continue
receivable_id = line.receivable_id.id
if receivable_id in processed_receivable_ids:
continue
processed_receivable_ids.add(receivable_id)
rec = line.receivable_id
wizards = self.env['penalty.line.wizard'].search(
[('receivable_id', '=', receivable_id)]
)
for wizard in wizards:
for pay in wizard.pay_line_ids:
if not pay.date:
continue
if pay.date <= period_end:
amount = round(pay.amount, 2)
if not wizards:
# 如果没有关联的wizard,尝试直接从line获取信息
if line.delivered1 and line.create_date:
if line.create_date.date() <= period_end:
amount = round(line.delivered1, 2)
total_amount += amount
rows.append({
"序号": idx,
@@ -94,7 +88,7 @@ class DepositPreReceivedReport(models.Model):
'id': rec.lessee_id.id,
'display_name': rec.lessee_id.name,
} if rec.lessee_id else "",
"收款日期": pay.date.strftime("%Y-%m-%d"),
"收款日期": line.create_date.strftime("%Y-%m-%d"),
"金额": amount,
"所属公司": rec.company_id.name if rec.company_id else "",
"管理员": {
@@ -104,6 +98,41 @@ class DepositPreReceivedReport(models.Model):
} if rec.admin_id else "",
})
idx += 1
else:
for wizard in wizards:
for pay in wizard.pay_line_ids:
if not pay.date:
continue
if pay.date <= period_end:
amount = round(pay.amount, 2)
total_amount += amount
rows.append({
"序号": idx,
"合同编号": {
'model': 'property.lease.contract',
'id': rec.contract_id.id,
'display_name': rec.contract_id.contract_code,
} if rec.contract_id else "",
"物业名称": {
'model': 'yuthon.property',
'id': rec.contract_id.lease_ids[0].address_id.id,
'display_name': rec.property_name,
} if rec.contract_id and rec.contract_id.lease_ids and rec.contract_id.lease_ids[0].address_id else rec.property_name or "",
"承租方名称": {
'model': 'property.tenant.information',
'id': rec.lessee_id.id,
'display_name': rec.lessee_id.name,
} if rec.lessee_id else "",
"收款日期": pay.date.strftime("%Y-%m-%d"),
"金额": amount,
"所属公司": rec.company_id.name if rec.company_id else "",
"管理员": {
'model': 'res.users',
'id': rec.admin_id.id,
'display_name': rec.admin_id.name,
} if rec.admin_id else "",
})
idx += 1
stats = [
{'name': '记录总数', 'amount': len(rows)},