Record income receipts as a user receivable, not an entity asset

When a user submits income, the money is physically in *their* pocket,
not the entity's cash drawer. The original income endpoint posted DR
on a configurable payment-method asset account (Cash/Bank/Lightning),
which implicitly assumed the entity already had the funds.

Mirror the expense flow instead: DR Assets:Receivable:User-{id[:8]}
(via get_or_create_user_account), CR the revenue account. The user
now owes the entity until they hand the cash over via the existing
/settle-receivable workflow. With this, the per-user Outstanding
Balances card correctly nets expenses (entity owes user, -liability)
against income receipts (user owes entity, +receivable).

Drops payment_method_account from IncomeEntry — no longer needed.
This commit is contained in:
Padreug 2026-05-16 23:40:08 +02:00
commit 0f2a38ee7f
3 changed files with 21 additions and 23 deletions

View file

@ -889,7 +889,7 @@ def format_revenue_entry(
def format_income_entry(
user_id: str,
payment_account: str,
user_account: str,
revenue_account: str,
amount_sats: int,
description: str,
@ -906,7 +906,8 @@ def format_income_entry(
fiat-first price notation (@@ SATS) for BQL queryability, unique link
(^inc-{entry_id}) for tracking through the approve/reject flow.
Postings: DR payment_account (asset receives funds), CR revenue_account.
Postings: DR user_account (Assets:Receivable:User-{id} user owes
the entity until they hand the cash over), CR revenue_account.
"""
if not fiat_currency or not fiat_amount or fiat_amount <= 0:
raise ValueError("fiat_currency and a positive fiat_amount are required for income entries")
@ -921,7 +922,7 @@ def format_income_entry(
postings = [
{
"account": payment_account,
"account": user_account,
"amount": f"{fiat_amount_abs:.2f} {fiat_currency} @@ {sats_abs} SATS",
},
{