feat: the pickup receipt in Recibos/ and "Retirado" on the card (Dropstar's third round, item 14)
All checks were successful
Build and deploy / Validate source (push) Successful in 4s
Build and deploy / Integration suite on a real stack (push) Successful in 3m38s
Build and deploy / Secret scan and release gate (push) Successful in 5s
Build and deploy / Publish images (push) Successful in 59s

A pickup order reaching Finalizado has its receipt due: a PDF for the
80 mm roll with the order number large at the top, the customer and
CPF/CNPJ, each product and its metres, the amount and how it was paid,
the date issued, and the "Retirado em" and "Assinatura" lines
(app/receipt.py). The Kanban's folder saves it in Recibos/, where the
counter's print queue sends it to the Bematech. One computer claims each
receipt on the server before writing it, so it is never printed twice,
and gives it back if it could not save it. Orders sent by carrier have
none.

"Retirado" on a pickup in Finalizado records when and who handed it
over, with an optional photo of the signed receipt (kept 30 days). Anyone
but the seller may mark it (new "deliver" capability); the order panel
also opens the receipt to print it again.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Cauê Faleiros
2026-10-29 18:39:17 -03:00
parent a5417d200e
commit d962865944
8 changed files with 378 additions and 14 deletions

View File

@@ -401,3 +401,16 @@ CREATE TABLE IF NOT EXISTS dtf_local.reworks (
authorized boolean, decided_by text, decided_at timestamptz, decline_reason text
);
CREATE INDEX IF NOT EXISTS reworks_order ON dtf_local.reworks(order_id);
-- The pickup receipt (Dropstar's third round, item 14, 2026-10-29): due when
-- an order to be picked up reaches Finalizado; one computer's folder claims
-- it and saves the PDF in Recibos/, where the counter's print queue sends it
-- to the Bematech. Claimed once, so it is never printed twice.
ALTER TABLE dtf_local.orders ADD COLUMN IF NOT EXISTS receipt_due_at timestamptz;
ALTER TABLE dtf_local.orders ADD COLUMN IF NOT EXISTS receipt_saved_at timestamptz;
ALTER TABLE dtf_local.orders ADD COLUMN IF NOT EXISTS receipt_saved_by text;
-- "Retirado": when, who handed it over and, optionally, a photo of the
-- signed receipt. Finalizado means ready; this means delivered.
ALTER TABLE dtf_local.orders ADD COLUMN IF NOT EXISTS picked_up_at timestamptz;
ALTER TABLE dtf_local.orders ADD COLUMN IF NOT EXISTS picked_up_by text;
ALTER TABLE dtf_local.orders ADD COLUMN IF NOT EXISTS picked_up_photo uuid REFERENCES dtf_local.uploads(id) ON DELETE SET NULL;