akt-cli 0.7.0__tar.gz → 0.8.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {akt_cli-0.7.0 → akt_cli-0.8.0}/PKG-INFO +1 -1
- {akt_cli-0.7.0 → akt_cli-0.8.0}/pyproject.toml +1 -1
- {akt_cli-0.7.0 → akt_cli-0.8.0}/src/akt/cli.py +23 -0
- {akt_cli-0.7.0 → akt_cli-0.8.0}/LICENSE +0 -0
- {akt_cli-0.7.0 → akt_cli-0.8.0}/README.md +0 -0
- {akt_cli-0.7.0 → akt_cli-0.8.0}/src/akt/__init__.py +0 -0
- {akt_cli-0.7.0 → akt_cli-0.8.0}/src/akt/client.py +0 -0
- {akt_cli-0.7.0 → akt_cli-0.8.0}/src/akt/coa.py +0 -0
- {akt_cli-0.7.0 → akt_cli-0.8.0}/src/akt/commands.py +0 -0
- {akt_cli-0.7.0 → akt_cli-0.8.0}/src/akt/config.py +0 -0
- {akt_cli-0.7.0 → akt_cli-0.8.0}/src/akt/ledger.py +0 -0
- {akt_cli-0.7.0 → akt_cli-0.8.0}/src/akt/output.py +0 -0
- {akt_cli-0.7.0 → akt_cli-0.8.0}/src/akt/registry.py +0 -0
- {akt_cli-0.7.0 → akt_cli-0.8.0}/src/akt/reports.py +0 -0
- {akt_cli-0.7.0 → akt_cli-0.8.0}/src/akt/resources.py +0 -0
- {akt_cli-0.7.0 → akt_cli-0.8.0}/src/akt/verify.py +0 -0
|
@@ -226,6 +226,12 @@ def _build_parser() -> argparse.ArgumentParser:
|
|
|
226
226
|
p.add_argument("--to", dest="date_to", metavar="YYYY-MM-DD")
|
|
227
227
|
p.set_defaults(_special=sp)
|
|
228
228
|
|
|
229
|
+
gp = sub.add_parser("gc-ledger", parents=[common],
|
|
230
|
+
help="Report/remove orphaned ledger rows (needs the akt-api module)")
|
|
231
|
+
gp.add_argument("--apply", action="store_true",
|
|
232
|
+
help="delete the orphaned rows (default: report only)")
|
|
233
|
+
gp.set_defaults(_special="gc_ledger")
|
|
234
|
+
|
|
229
235
|
return parser
|
|
230
236
|
|
|
231
237
|
|
|
@@ -444,6 +450,23 @@ def _run_special(name: str, client: Client, ns: Any) -> int:
|
|
|
444
450
|
print(f" {'Net income to date':>40} {bs['net_income']:>12,.2f}")
|
|
445
451
|
print(" BALANCED" if bs["balanced"] else " *** DOES NOT BALANCE")
|
|
446
452
|
return 0 if bs["balanced"] else 1
|
|
453
|
+
if name == "gc_ledger":
|
|
454
|
+
_need_akt_api(client, "gc-ledger")
|
|
455
|
+
rep = client.get("akt-api/ledgers/orphans")
|
|
456
|
+
data = rep.get("data", rep) if isinstance(rep, dict) else rep
|
|
457
|
+
total = data.get("total", 0)
|
|
458
|
+
if not ns.apply:
|
|
459
|
+
if ns.json:
|
|
460
|
+
emit(data, as_json=True)
|
|
461
|
+
else:
|
|
462
|
+
for t, c in (data.get("by_type") or {}).items():
|
|
463
|
+
print(f" {c:>6} {t}")
|
|
464
|
+
print(f"{total} orphaned ledger row(s). Run with --apply to delete.")
|
|
465
|
+
return 0
|
|
466
|
+
res = client.request("DELETE", "akt-api/ledgers/orphans")
|
|
467
|
+
d = res.get("data", res) if isinstance(res, dict) else res
|
|
468
|
+
print(f"deleted {d.get('deleted', 0)} orphaned ledger row(s).")
|
|
469
|
+
return 0
|
|
447
470
|
raise ValueError(name)
|
|
448
471
|
|
|
449
472
|
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|