Skip to content

Commit 16b9621

Browse files
authored
feat(ledger): record_deconsolidation on the facade (#283)
## Summary The facade catches up with three generated-tier regens. `LedgerClient.record_deconsolidation(graph_id, *, entity_id, consideration, basis)` beside `record_acquisition` and `record_ownership_change`. The calendar and entity reads already return the generated models, which carry `is_former` and the unmapped-account fields. A client **minor**: additive facade surface. The deconsolidation operation is live on the API since v1.20.0's successor carries rs #1926; `is_former` likewise; the unmapped-account fields wait on [rs #1932](RoboFinSystems/robosystems#1932). roboledger-app's group-lifecycle work builds on this. ## Testing `just test-all`: 732 passed, 17 skipped; ruff, format and basedpyright clean. 🤖 Generated with [Claude Code](https://claude.com/claude-code) https://claude.ai/code/session_015PxYaVzrbraKFeRALM7rXp
2 parents b2c3af0 + 9197a83 commit 16b9621

2 files changed

Lines changed: 56 additions & 0 deletions

File tree

‎robosystems_client/clients/ledger_client.py‎

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,9 @@
6969
from ..api.robo_ledger_ledger_events.record_ownership_change import (
7070
sync_detailed as op_record_ownership_change,
7171
)
72+
from ..api.robo_ledger_ledger_events.record_deconsolidation import (
73+
sync_detailed as op_record_deconsolidation,
74+
)
7275
from ..api.robo_ledger_ledger_events.record_statement_balance import (
7376
sync_detailed as op_record_statement_balance,
7477
)
@@ -630,6 +633,8 @@
630633
from ..models.record_acquisition_request import RecordAcquisitionRequest
631634
from ..models.ownership_change_response import OwnershipChangeResponse
632635
from ..models.record_ownership_change_request import RecordOwnershipChangeRequest
636+
from ..models.deconsolidation_response import DeconsolidationResponse
637+
from ..models.record_deconsolidation_request import RecordDeconsolidationRequest
633638
from ..models.live_financial_statement_request import LiveFinancialStatementRequest
634639
from ..models.financial_statement_analysis_response import (
635640
FinancialStatementAnalysisResponse,
@@ -2720,6 +2725,33 @@ def record_ownership_change(
27202725
"Record ownership change", envelope, OwnershipChangeResponse
27212726
)
27222727

2728+
def record_deconsolidation(
2729+
self,
2730+
graph_id: str,
2731+
*,
2732+
entity_id: str,
2733+
consideration: int,
2734+
basis: str,
2735+
) -> DeconsolidationResponse:
2736+
"""Record a member's leaving the group once ``left_on`` is set on it:
2737+
what the parent received for its shares in cents (0 for a dissolution)
2738+
and the ``basis``. Writes a draft in the consolidation entity, dated the
2739+
first day of the month after the member's last, that its close posts:
2740+
what the entity still held for the member is taken off, a member in full
2741+
has its results put back into the group's equity, and the difference is
2742+
the gain or loss on its leaving — the group's adjustment to the parent's
2743+
own gain (ASC 810)."""
2744+
body = RecordDeconsolidationRequest(
2745+
entity_id=entity_id, consideration=consideration, basis=basis
2746+
)
2747+
response = op_record_deconsolidation(
2748+
graph_id=graph_id, body=body, client=self._get_client()
2749+
)
2750+
envelope = self._call_op("Record deconsolidation", response)
2751+
return self._typed_result(
2752+
"Record deconsolidation", envelope, DeconsolidationResponse
2753+
)
2754+
27232755
# ── Event blocks (generic preview + status transitions) ──────────────
27242756

27252757
def create_event_block(

‎tests/test_ledger_client.py‎

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1195,6 +1195,30 @@ def test_record_ownership_change(self, mock_op, mock_config, graph_id):
11951195
"basis": "Share purchase agreement",
11961196
}
11971197

1198+
@patch("robosystems_client.clients.ledger_client.op_record_deconsolidation")
1199+
def test_record_deconsolidation(self, mock_op, mock_config, graph_id):
1200+
envelope = _envelope(
1201+
"record-deconsolidation",
1202+
{
1203+
"entity_id": "ent_cafe",
1204+
"period": "2026-06",
1205+
"consideration": 6200000,
1206+
"earnings_restored": 2440000,
1207+
"gain_loss": -2443412,
1208+
},
1209+
)
1210+
mock_op.return_value = _mock_response(envelope)
1211+
client = LedgerClient(mock_config)
1212+
result = client.record_deconsolidation(
1213+
graph_id, entity_id="ent_cafe", consideration=6200000, basis="Sale agreement"
1214+
)
1215+
assert result["gain_loss"] == -2443412
1216+
assert mock_op.call_args.kwargs["body"].to_dict() == {
1217+
"entity_id": "ent_cafe",
1218+
"consideration": 6200000,
1219+
"basis": "Sale agreement",
1220+
}
1221+
11981222

11991223
# ── Taxonomy / entity linking ───────────────────────────────────────────
12001224

0 commit comments

Comments
 (0)