An invoice saved with no amount landed as amount_incl = 0 (PocketBase
stores a number field as zero, not null), so the PO read "R 0,00 invoiced"
and the money never booked. There were two ways to give it an amount and
neither worked: the Upload-invoice modal let a blank amount save silently,
while the double-click correction form refused to save without a value AND
a written reason, and sat behind Edit mode.
- lib/purchase-invoice-amount.ts holds the rules, shared by the screen and
the API so they cannot disagree. R0 is not an amount: a blank amount and
a figure of zero are both refused, so an invoice can never land as zero.
- The API now separates PRICING an invoice that never had an amount (no
reason owed, still logged) from CORRECTING one that was booked (Full user
+ a reason, as before).
- Double-clicking an amount on a PO opens the ordinary invoice modal on
that invoice, with the amount field waiting. The inline correction form is
gone — one window, one rule. There is no pencil button: a booked figure
must take a deliberate second gesture, so a single stray tap never opens
a form that can rewrite money.
- The PO-lines table freezes its Description column with an opaque
background and fades its right edge, so it passes the mobile checklist.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>