From 7456574f65af39adf519372212081c3e5e2c59cb Mon Sep 17 00:00:00 2001 From: Padreug Date: Mon, 15 Jun 2026 23:53:04 +0200 Subject: [PATCH] fix(accounts): default CreateChartAccount.currencies to None MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The UI omits currencies so the Open directive is written unconstrained, but the model defaulted currencies to ["EUR","SATS","USD"], so Pydantic refilled them and the endpoint passed the constraint through — every admin-created account got a currency-constrained Open (which would reject postings in other currencies, the same CAD/GBP/JPY bean-check class we hit on user accounts). Default to None so omission reaches add_account and the directive is unconstrained; an explicit list still works for API callers. Co-Authored-By: Claude Opus 4.8 (1M context) --- models.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/models.py b/models.py index 8be64c9..c8632d0 100644 --- a/models.py +++ b/models.py @@ -51,7 +51,11 @@ class CreateAccount(BaseModel): class CreateChartAccount(BaseModel): """Admin-created chart-of-accounts entry written to accounts/chart.beancount.""" name: str # Full hierarchical account name, e.g. "Expenses:Services:Domain" - currencies: list[str] = ["EUR", "SATS", "USD"] + # Optional currency constraint. Omitted by the UI: an Open directive needs + # no currency list, and constraining it would reject postings in other + # currencies (the CAD/GBP/JPY bean-check errors we saw on user accounts). + # None → unconstrained Open; a list → explicit constraint for API callers. + currencies: Optional[list[str]] = None description: Optional[str] = None