This commit is contained in:
李鹏宇
2026-03-02 21:33:31 +08:00
parent 359395a41f
commit 6148d9ee4a
3 changed files with 19 additions and 3 deletions
@@ -79,7 +79,11 @@ class CurrentReceivablePropertyFeeReport(models.Model):
for idx, rec in enumerate(receivables, start=1):
amt = rec.original_amount or 0.0
# 从合同获取税率
tax_rate = float(rec.contract_id.tax_rate.name.replace('%', '')) if rec.contract_id and rec.contract_id.tax_rate else 0.0
try:
tax_rate_str = str(rec.contract_id.tax_rate.name) if rec.contract_id and rec.contract_id.tax_rate else "0"
tax_rate = float(tax_rate_str.replace('%', '').strip()) if tax_rate_str else 0.0
except (ValueError, TypeError):
tax_rate = 0.0
amt_nt = amt / (1 + tax_rate / 100) if tax_rate else amt
total_amount += amt
total_amount_nt += amt_nt
@@ -64,7 +64,11 @@ class CurrentReceivableRentReport(models.Model):
# 实际应收 = 原始金额 - 减免金额
actual_amt = amt - discount
# 从合同获取税率
tax_rate = float(rec.contract_id.tax_rate.name.replace('%', '')) if rec.contract_id and rec.contract_id.tax_rate else 0.0
try:
tax_rate_str = str(rec.contract_id.tax_rate.name) if rec.contract_id and rec.contract_id.tax_rate else "0"
tax_rate = float(tax_rate_str.replace('%', '').strip()) if tax_rate_str else 0.0
except (ValueError, TypeError):
tax_rate = 0.0
actual_amt_nt = actual_amt / (1 + tax_rate / 100) if tax_rate else actual_amt
# 统计每个管理类型的合计
+9 -1
View File
@@ -78,7 +78,15 @@ class YuthonProperty(models.Model):
'display_name': rec.contract_id.contract_code,
} if rec.contract_id else "",
"发票类型": invoice_type_map.get(rec.invoice_type, ""),
"税率": f"{float(rec.contract_id.tax_rate.name.replace('%', '')):.1f}%" if rec.contract_id and rec.contract_id.tax_rate else "0.0%"
"税率": (
lambda tr: (
lambda v: f"{v:.1f}%" if v is not None else "0.0%"
)(
float(str(tr).replace('%', '').strip())
if tr and str(tr).replace('%', '').strip()
else None
)
)(rec.contract_id.tax_rate.name if rec.contract_id and rec.contract_id.tax_rate else None)
})
summary_stats = []