HEL-206: 修正公司间期末余额方向为转出=应收增加

翻转 _pair_net_change 符号,与往来层/页面口径一致;同步修正旧断言并新增期初200+转出100=期末300的双边守恒与浏览器方向冒烟。

Co-authored-by: Cursor <cursoragent@cursor.com>
Co-authored-by: multica-agent <github@multica.ai>
This commit is contained in:
总工
2026-08-27 17:49:56 +00:00
co-authored by Cursor multica-agent
parent fe6b4e59ec
commit 2fb1f2b462
3 changed files with 474 additions and 4 deletions
+4 -2
View File
@@ -840,12 +840,14 @@ def _pair_net_change(
""",
params,
).fetchall()
# 站在本公司视角:正数=应收方向。转出/垫付(payer)使应收增加。
# 与 company_transfers.net = outflow inflow 及页面文案口径一致。
total = Decimal("0")
for row in rows:
amount = _parse_decimal(row["amount"])
if row["payee_id"] == viewer_id:
if row["payer_id"] == viewer_id:
total += amount
elif row["payer_id"] == viewer_id:
elif row["payee_id"] == viewer_id:
total -= amount
return total