fix(accounts): don't currency-constrain per-user account opens (libra-#49)

get_or_create_user_account opened per-user receivable/payable accounts
constrained to EUR/SATS/USD, so a posting in any other currency tripped
'Invalid currency CAD/GBP/JPY for account Assets:Receivable:User-…' at
bean-check — the exact errors the optional-currencies work set out to fix,
which had only reached the admin chart-account path. Open user accounts
unconstrained (currencies=None) so they hold arbitrary fiat.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
Padreug 2026-06-17 10:06:57 +02:00
commit 26eb9d4579

View file

@ -250,9 +250,13 @@ async def get_or_create_user_account(
if not fava_account_exists: if not fava_account_exists:
# Create account in Fava/Beancount via Open directive # Create account in Fava/Beancount via Open directive
logger.info(f"[FAVA CREATE] Creating account in Fava: {account_name}") logger.info(f"[FAVA CREATE] Creating account in Fava: {account_name}")
# Unconstrained Open: a per-user receivable/payable legitimately
# holds arbitrary fiat (CAD/GBP/JPY/…). Constraining it to
# EUR/SATS/USD made any posting in another currency fail
# bean-check (the errors this account path originally exhibited).
await fava.add_account( await fava.add_account(
account_name=account_name, account_name=account_name,
currencies=["EUR", "SATS", "USD"], # Support common currencies currencies=None,
metadata={ metadata={
"user_id": user_id, "user_id": user_id,
"description": f"User-specific {account_type.value} account" "description": f"User-specific {account_type.value} account"