Skip to content

Commit 769c9ca

Browse files
committed
feat(ledger): list_elements can include retired accounts
`include_inactive` asks the elements read for retired accounts beside the active ones. Default unchanged. Needs robosystems #1923; the twin of typescript-client #294. Claude-Session: https://claude.ai/code/session_01VPxBBHkqhwkZ6Eq8EXSBR6
1 parent 22b5cac commit 769c9ca

6 files changed

Lines changed: 16 additions & 2 deletions

File tree

‎robosystems_client/clients/ledger_client.py‎

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1565,10 +1565,12 @@ def list_elements(
15651565
source: str | None = None,
15661566
classification: str | None = None,
15671567
is_abstract: bool | None = None,
1568+
include_inactive: bool = False,
15681569
limit: int = 100,
15691570
offset: int = 0,
15701571
) -> LedgerElementsPage | None:
1571-
"""List elements (CoA accounts, GAAP concepts, etc.) with filters."""
1572+
"""List elements (CoA accounts, GAAP concepts, etc.) with filters;
1573+
``include_inactive`` adds retired accounts, to reactivate one."""
15721574
data = self._query(
15731575
graph_id,
15741576
LIST_LEDGER_ELEMENTS_GQL,
@@ -1577,6 +1579,7 @@ def list_elements(
15771579
"source": source,
15781580
"classification": classification,
15791581
"isAbstract": is_abstract,
1582+
"includeInactive": include_inactive,
15801583
"limit": limit,
15811584
"offset": offset,
15821585
},

‎robosystems_client/graphql/generated/client.py‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -907,6 +907,7 @@ def list_ledger_dimensions(
907907

908908
def list_ledger_elements(
909909
self,
910+
include_inactive: bool,
910911
limit: int,
911912
offset: int,
912913
taxonomy_id: Union[Optional[str], UnsetType] = UNSET,
@@ -920,6 +921,7 @@ def list_ledger_elements(
920921
"source": source,
921922
"classification": classification,
922923
"isAbstract": is_abstract,
924+
"includeInactive": include_inactive,
923925
"limit": limit,
924926
"offset": offset,
925927
}

‎robosystems_client/graphql/generated/operations.py‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1941,12 +1941,13 @@
19411941
"""
19421942

19431943
LIST_LEDGER_ELEMENTS_GQL = """
1944-
query ListLedgerElements($taxonomyId: String, $source: String, $classification: String, $isAbstract: Boolean, $limit: Int! = 100, $offset: Int! = 0) {
1944+
query ListLedgerElements($taxonomyId: String, $source: String, $classification: String, $isAbstract: Boolean, $includeInactive: Boolean! = false, $limit: Int! = 100, $offset: Int! = 0) {
19451945
elements(
19461946
taxonomyId: $taxonomyId
19471947
source: $source
19481948
classification: $classification
19491949
isAbstract: $isAbstract
1950+
includeInactive: $includeInactive
19501951
limit: $limit
19511952
offset: $offset
19521953
) {

‎robosystems_client/graphql/operations/ledger/ListLedgerElements.graphql‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ query ListLedgerElements(
33
$source: String
44
$classification: String
55
$isAbstract: Boolean
6+
$includeInactive: Boolean! = false
67
$limit: Int! = 100
78
$offset: Int! = 0
89
) {
@@ -11,6 +12,7 @@ query ListLedgerElements(
1112
source: $source
1213
classification: $classification
1314
isAbstract: $isAbstract
15+
includeInactive: $includeInactive
1416
limit: $limit
1517
offset: $offset
1618
) {

‎robosystems_client/graphql/schema.graphql‎

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -559,6 +559,11 @@ type Query {
559559
"""
560560
isAbstract: Boolean = null
561561

562+
"""
563+
Include retired accounts (`isActive: false`), so one can be found and reactivated. Omit for active elements only.
564+
"""
565+
includeInactive: Boolean! = false
566+
562567
"""
563568
Maximum rows to return, 1-1000. Omit to use this field's own default; out of range raises `INVALID_PAGINATION`.
564569
"""

‎tests/test_ledger_client.py‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1841,6 +1841,7 @@ def test_list_elements(self, mock_execute, mock_config, graph_id):
18411841
variables = mock_execute.call_args[0][2]
18421842
assert variables["taxonomyId"] == "tax_coa_1"
18431843
assert variables["classification"] == "asset"
1844+
assert variables["includeInactive"] is False
18441845

18451846
@patch("robosystems_client.graphql.client.GraphQLClient.execute")
18461847
def test_list_unmapped_elements(self, mock_execute, mock_config, graph_id):

0 commit comments

Comments
 (0)