Task 7 of the non-invoiceable-order-extras plan. The status flip + audit stamp + delivery_note header create all run on EVERY row so the order closes normally — excluded rows are real operational lines from the supplier's POV. The PDF line list is built from billable.items only, so the customer never sees excluded lines. Added exclude_from_invoice to the getFullList projection (load- bearing — omit it and the billable filter silently passes undefined, every extra lands on the customer delivery note). New 400 guard 'No billable lines for a delivery note' when every row in the request is excluded. UI guard in Task 6 prevents the operator from reaching this path, but the route has its own defence so the picker doesn't get a guaranteed-to-fail submit silently. 2 tests + 1 mutation-test prove the split: - excluded rows still get status flip + DN number + PDF upload, but the renderer is called with ONLY billable items - all-excluded returns 400 before any PATCH fires - mutation (PDF built from items): the mixed test fails because the renderer sees 3 lines instead of 2 Co-Authored-By: Claude <noreply@anthropic.com> |
||
|---|---|---|
| .. | ||
| app | ||
| components | ||
| lib | ||
| styles | ||
| middleware.ts | ||
| test-setup.ts | ||