Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 10 additions & 2 deletions SPEC.md
Original file line number Diff line number Diff line change
Expand Up @@ -174,7 +174,15 @@ Added after first real use (2026-10-07):
Added 2026-10-21:
- any invoice or quote, in any status, can be copied into a new draft of the same kind: same customer, language, intro and footer text, and the lines as they are (VAT rate included). The copy gets no number, dates (including a quote's expiry date), notes or snapshots until it is issued or sent itself, and no `related_document` (it is not a correction; that stays a credit note). The original is not touched. Credit notes have no copy.
- the PDF button opens a page with the PDF, a way back to the document, and Download (named after the document's number, `<number>.pdf`, ready to attach to an e-mail); where the browser can share files there is also Share, and in the installed app only Share; for an imported invoice with an original PDF the page switches between the original and the regenerated one; the editor's preview PDF still opens in a new tab; in the installed app it opens over the editor, which keeps what was typed;
- on a phone every action stays reachable: the editor's secondary actions (delete, cancel, copy, PDF, preview PDF, mail) sit behind a "Meer" button in its action bar, the tab bar's + opens the same four choices as the sidebar's "Nieuw" (factuur, offerte, klant, uitgave), and with its "Meer" menu the tab bar offers everything else the sidebar does. `tests/e2e/test_every_page.py` checks both on every page.
- on a phone every action stays reachable: the editor's secondary actions (delete, cancel, copy, PDF, preview PDF, mail) sit behind a "Meer" button in its action bar, the tab bar's + opens four choices (factuur, offerte, klant, uitgave), and with its "Meer" menu the tab bar offers everything else the sidebar does. `tests/e2e/test_every_page.py` checks both on every page.
Added with the layout of direction "Vandaag" (issue #186, 2026-11-15; product-owner agent, `huismus-intern/besluiten.md`):
- on a wide screen the menu is a deep violet panel: the sparrow, "Je krijgt nog" (what customers still owe, and how much of it is overdue; `core.dashboard.outstanding_invoices`, the overview's figure, nothing before the first issued invoice), a button "Nieuwe factuur" straight to a new invoice, then Overzicht, Facturen, Offertes, Uitgaven, Klanten, Rapporten, Importeren, Instellingen; Hulp and Uitloggen at the foot. Cards have no border and round corners on a lilac background, buttons are pills, the font is the rounded system font where there is one (no web font);
- one violet button per screen: the panel's "Nieuwe factuur" and the phone's + only on the overview and the invoice list (not when they are empty); elsewhere the screen's own main action;
- the invoice list shows its rows in groups: Te laat, Wacht op betaling (with the days until due), Nog niet verstuurd, Betaald (fully credited ones too), Creditnota's; tabs, search, year and "Meer laden" stay. "Geïmporteerd" is quiet text, and only overdue has a colour;
- an overview without any invoice or credit note shows one card to make the first instead of the invoice figures;
- in the invoice editor on a phone the total stays in sight in the bar above the tab bar;
- notices are quiet blocks: their kind shows in a round icon, only a real problem is red;
- the cost bars in the year overview are yellow without an edge, like the other yellow bars; their amounts are in the table below (the owner, 2026-11-15).
Out of scope: command palette with global search, live preview in settings.
*Done when:* every screen matches the design reference on desktop and at 360px wide, in both themes; existing tests stay green; the PDF smoke test passes with the restyled template.

Expand Down Expand Up @@ -315,7 +323,7 @@ Asked by the owner on 2026-11-06: with the KOR off, Huismus records exactly the
- **Part 1, invoices: VAT per rate, stored.** A line keeps its rate and whether it is reverse charged, as before (M18). On issuing, an invoice or credit note stores per rate, reverse charge apart, its revenue and VAT exactly as on its PDF (`DocumentVatRow`, `huismus/documents/vat_snapshot.py`, amounts from `documents.totals.vat_rows`): computed per rate group, never per line (invariant 3), and never changed afterwards, also not when Huismus's code changes. "Toch bewerken" and issuing again stores them anew; "Annuleren" keeps the stored ones (a document reopened before they existed gets them from what it was issued with). A Moneybird import stores them when its stated totals are those of its lines, else none: Huismus doesn't guess a split (hard rule 6), and the VAT return names such documents apart. Documents issued before this got their rows once (migration `documents.0016`, approved by the owner); the documents themselves did not change. Nothing changes on screen or on the PDF.
- **Part 2, expenses: a VAT rate per line** (`ExpenseLine.vat_rate`, `huismus/expenses/models.py` `VatRate`). "Btw-tarief": 21%, 9%, "0% of geen btw", "Btw verlegd: Nederland", "Btw verlegd: ander EU-land", "Btw verlegd: buiten de EU". Required without the KOR, with no preset choice ("Kies…", error "Kies het btw-tarief."); not on the form under the KOR, where a stored one stays. The VAT amount is always what the user enters, never computed; "0% of geen btw" with VAT above € 0 is refused ("Bij 0% of geen btw is het btw-bedrag € 0,00."), no other check. Without the KOR the field "btw ter info" is called "Btw", and the note under the lines says "Btw: zoals op het bonnetje. Staat er geen btw op, vul dan 0 in en kies 0% of geen btw." instead of "ter informatie" (once, not under every line). The AI connection (`add_expense`, `vat_rate`) and Bonnetjes lezen take the rate as on the receipt; without the KOR a missing or unknown one leaves the receipt in the tray ("Niet gelezen: het btw-tarief staat er niet bij."). Under the KOR they go through the same form, which has no rate: a rate they give is not kept, as when the user types. The Moneybird import takes 21, 9 and 0 when Moneybird's rate name says exactly that, and its "Binnen EU 21% (btw verlegd)" and "Buiten EU 21% (btw verlegd)" as reverse charge in another EU country and outside the EU; any other rate (an old 6%, or a rate without a name) stays empty and the dry run names it ("Btw-tarief onbekend"); an export without rate columns gives no message. Existing expenses keep no rate: none is guessed. A line without a rate never counts as input VAT.
- **Part 3, input VAT** (product-owner agent 2026-11-07, `huismus-intern/besluiten.md`, "Voorbelasting op uitgaven: wanneer, verlegd, weergave en label"). With the KOR off, the year overview reads the costs per expense line (`huismus/reports/year_overview.py`): at 21, 9 or 0% costs = gross − VAT and the VAT is input VAT; reverse charged or without a rate, costs = gross. Its card "Kosten zonder btw" with "Voorbelasting € …" under it, a column "Voorbelasting" per quarter, "Kosten zonder btw per categorie", the CSV (columns "kosten zonder btw" and "voorbelasting"), the overview's "Kosten zonder btw" and the AI connection's `list_expenses` (`total`, `total_without_vat`, `input_vat`) follow; profit = revenue − costs without VAT. With the KOR on everything stays gross, as before, also for past years. Nothing stored changes (hard rule 7). The export's `uitgaveregels.csv` gets "btw-tarief" (the name as on the page) and calls the VAT column "btw" without the KOR, "btw ter info" with it; `uitgaven.csv` stays gross. Later: after turning the KOR off, past KOR years show input VAT for imported lines that have a rate; such a rate can be emptied on the expense.
- **Part 4, the VAT return** (product-owner agent 2026-11-07, `huismus-intern/besluiten.md`, "Btw-aangifterapport: plek, periode, opbouw en wat niet meetelt"; which box holds what: the owner, escalation list 1). Rapporten → Btw-aangifte (`/rapporten/btw-aangifte/`, `huismus/reports/vat_return.py`), with tabs "Jaaroverzicht | Btw-aangifte" above both reports; the menu still opens the year overview. A period is a quarter, month or year (`?periode=2026-Q3`, `2026-07`, `2026`, `huismus/reports/periods.py`); by default and for anything unknown or not yet begun, the last finished quarter; no step beyond the current one. It only reads. Sales: the stored rows (part 1) of invoices and credit notes with status issued and an invoice date in the period, a credit note negative: 21% → 1a, 9% → 1b, 0% → 1e, reverse charged by the country in the customer snapshot: Netherlands → 1e, another EU country → 3b, which counts in the period of the delivery date when the document has one and else of the invoice date, so it can come from a document invoiced in another period (issue #113) (EU list and box titles in `docs/belastingregels.md`, "Rubrieken in detail"). Purchases: expense lines by their expense's date: "Btw verlegd: Nederland" → 2a, "buiten de EU" → 4a, "ander EU-land" → 4b, each with the amount as value and the VAT the user entered; 5b is the VAT of lines at 21, 9 or 0% plus that reverse charged VAT ("waarvan verlegd"). 5a is the VAT of boxes 1 to 4; then "Te betalen" or "Terug te krijgen". Amounts in cents, not rounded. Box titles word for word from the Belastingdienst's explanation. Under "Niet meegeteld", with a warning at the top and a link per item: issued documents without rows (Moneybird's amounts), rows at another rate (6% before 2019), reverse charged to a customer outside the EU or without a country, documents with the KOR text, documents back in draft through "Toch bewerken", and expense lines without a rate or VAT. With the KOR on, the page shows only a notice with a link to the KOR settings and no figures (the owner, 2026-11-07): under the KOR the VAT on expenses counts nowhere (hard rule 7), and no expense line is read. The CSV and the AI connection: part 5.
- **Part 4, the VAT return** (product-owner agent 2026-11-07, `huismus-intern/besluiten.md`, "Btw-aangifterapport: plek, periode, opbouw en wat niet meetelt"; which box holds what: the owner, escalation list 1). Rapporten → Btw-aangifte (`/rapporten/btw-aangifte/`, `huismus/reports/vat_return.py`), with tabs "Jaaroverzicht | Btw-aangifte" above both reports; the menu still opens the year overview. A period is a quarter, month or year (`?periode=2026-Q3`, `2026-07`, `2026`, `huismus/reports/periods.py`); by default and for anything unknown or not yet begun, the last finished quarter; no step beyond the current one. It only reads. Sales: the stored rows (part 1) of invoices and credit notes with status issued and an invoice date in the period, a credit note negative: 21% → 1a, 9% → 1b, 0% → 1e, reverse charged by the country in the customer snapshot: Netherlands → 1e, another EU country → 3b, which counts in the period of the delivery date when the document has one and else of the invoice date, so it can come from a document invoiced in another period (issue #113) (EU list and box titles in `docs/belastingregels.md`, "Rubrieken in detail"). Purchases: expense lines by their expense's date: "Btw verlegd: Nederland" → 2a, "buiten de EU" → 4a, "ander EU-land" → 4b, each with the amount as value and the VAT the user entered; 5b is the VAT of lines at 21, 9 or 0% plus that reverse charged VAT ("waarvan verlegd"). 5a is the VAT of boxes 1 to 4; then "Te betalen" or "Terug te krijgen". Amounts in cents, not rounded. Box titles word for word from the Belastingdienst's explanation. Under "Niet meegeteld", with a warning at the top and a link per item: issued documents without rows (Moneybird's amounts), rows at another rate (6% before 2019), reverse charged to a customer outside the EU or without a country, documents with the KOR text, documents back in draft through "Toch bewerken", and expense lines without a rate or VAT. With the KOR on there is no return to fill in: the page shows the notice with a link to the KOR settings, and this calendar year's revenue per quarter ("—" for a quarter still to come) with the KOR limit and its bar, the year overview's figures (`compute_year_overview`, `kor_limit_status`); no period choice, no CSV button (the owner in #186, 2026-11-15, replacing "only a notice" of 2026-11-07). Under the KOR the VAT on expenses counts nowhere (hard rule 7), and no expense line is read. The CSV and the AI connection: part 5.
- **Part 5, the VAT return as CSV and for the AI connection** (issue #112; product-owner agent 2026-11-07, `huismus-intern/besluiten.md`, "Btw-aangifterapport: CSV en AI-koppeling"). Both give the same boxes and the same "Niet meegeteld" as the page, from `compute_vat_return()`, and fall back to the same period. **CSV:** a button "CSV downloaden" on the page as on the year overview, `/rapporten/btw-aangifte/csv/?periode=…`, file `btw-aangifte-<period>.csv` in the CSV form of M19 (`huismus/reports/vat_return_csv.py`). Columns `periode;rubriek;omschrijving;nummer;datum;omzet;btw;bedrag`, headings and texts in the user's language: the period on every row; the seven boxes with their titles, also at 0,00; 5a and 5b with the amount under `btw`; "waarvan verlegd" on a row of its own without a box code when it isn't zero; one row "Te betalen" or "Terug te krijgen" without a sign. Then a row per item under "Niet meegeteld" with `rubriek` "niet meegeteld" and the heading of its card on the page, the rate or country after it ("…: 6%", "…: US", "…: land onbekend"); documents with number, invoice date, revenue and VAT as on the page (no VAT for the KOR text, no amounts for "Terug in concept"); an expense line with its expense's date, supplier and line description in `omschrijving` and its gross under `bedrag`. With the KOR on there is no button and the address leads back to the page. **AI connection:** a read tool `get_vat_return` ("Btw-aangifte bekijken", argument `period`), with the period used, per box code, title, revenue and VAT, `5a`, `5b`, `5b_reverse_charged` when not zero, `to_pay` or `to_get_back`, the first and last day of the period, and `not_counted` per kind with its heading and items (documents with their `id` for `get_document`, expense lines with `expense_id`). Its description tells the assistant to pass the boxes on as they are, always to name `not_counted`, and that Huismus files nothing. With the KOR on only `kor` and the page's notice, no figures. No PDF: the page can be printed.

## 7. Moneybird import (M5)
Expand Down
Loading
Loading