Mirrored from https://github.com/davoodmehraban89/Aram.git
Synced Dec 3, 20:45 UTC
fix(statements): count both sides of cash transfers and bound company scope
davoodmehraban89 committed
Oct 31, 2026 at 08:22 UTC
20f08dad5b3777efac33a396acf9a9723586e952
1 file changed
+3
-6
backend/src/aram_backend/cash_flow_direct_candidate.py
+3
-6
@@ -212,8 +212,7 @@ def build_direct_cash_flow_candidate(
212
recognized only when both cash accounts are explicitly registered and are
213
excluded from operating/investing/financing totals.
214
"""
215
- if not isinstance(company_code, str) or not company_code or company_code != company_code.strip():
216
- raise CoverageError("CASH_FLOW_COMPANY_SCOPE_INVALID")
215
+ company_code = _text(company_code, "COMPANY_SCOPE", max_length=64)
216
if type(fiscal_year) is not int or fiscal_year <= 0:
217
raise CoverageError("CASH_FLOW_YEAR_SCOPE_INVALID")
218
currency = _text(currency, "CURRENCY", max_length=16)
@@ -365,10 +364,8 @@ def build_direct_cash_flow_candidate(
364
transaction_turnovers[counterpart_code][1].append(counterpart_credit)
365
activity = "CASH_TRANSFER"
366
classification_evidence = cash_policy[counterpart_code].evidence_ref
368
- if cash_debit:
369
- transfer_inflows.append(cash_debit)
370
- else:
371
- transfer_outflows.append(cash_credit)
367
+ transfer_inflows.extend([cash_debit, counterpart_debit])
368
+ transfer_outflows.extend([cash_credit, counterpart_credit])
369
else:
370
policy = counterpart_policy.get(counterpart_code)
371
if policy is None: