WFDASH-WEBAPP/scripts
Dave e0d1356da5 feat(orders): add delivery-note repeat-order match fields
Five new fields on the `orders` collection:

- potential_delivery_note (relation → delivery_notes, single) — the
  DN whose items exactly matched this order's items
- potential_delivery_note_number (text) — denormalized copy of the
  matched DN's delivery_note_number, written alongside the relation
  so the orders list can render the number without a second `expand`
  (PB issues a separate IN query per expanded relation —
  orders-service.ts:253 documents why this is avoided here)
- delivery_note_match_confidence (number) — always 1 when set, kept
  for shape parity with quote_match_confidence
- delivery_note_match_method (text) — 'exact_items' or 'no_match',
  text not select for the same forward-compatibility reason
  quote_match_method is text
- delivery_note_matching_attempted (bool) — audit flag

Idempotent — each step detects its own 'already done' state.
Verified by re-running after the first apply.

Plan-staleness fix: PB stores relation options FLAT at the top
level of the field object (collectionId / cascadeDelete /
minSelect / maxSelect), not nested under an `options` key. The
plan's snippet had the nested form and PB rejected it with
'fields.N.collectionId Cannot be blank.' Verified the correct
shape against the live orders.potential_quote field before fixing.

Co-Authored-By: Claude <noreply@anthropic.com>
2026-08-30 12:57:16 +02:00
..
__pycache__ feat(mcp): enhance API documentation and add new tools 2026-08-15 00:06:40 +02:00
dev feat(sprint): add new sprint pricing workflow and supporting code 2026-07-03 07:29:43 +02:00
migrations feat(orders): add delivery-note repeat-order match fields 2026-08-30 12:57:16 +02:00
perf feat: add new order, invoice, and dashboard management tools 2026-08-05 23:00:54 +02:00
smoke feat(item-intel): add new item intel popover and backend workflows 2026-08-11 02:57:57 +02:00
utils refactor: switch hardcoded UI colors to semantic theme tokens 2026-07-07 17:22:03 +02:00
2026-08-03-load-husqvarna-cart.ts chore(scripts): one-time stock-order loaders + source screenshots 2026-08-03 17:33:28 +02:00
2026-08-03-load-yg1-quote-soq078608.ts chore(scripts): one-time stock-order loaders + source screenshots 2026-08-03 17:33:28 +02:00
2026-08-03-merge-yg1-drafts.ts chore(scripts): one-time stock-order loaders + source screenshots 2026-08-03 17:33:28 +02:00
2026-08-13-heal-item-intel.ts feat(tv): add TV dashboard + refine workflows 2026-08-13 20:55:22 +02:00
2026-08-21-backfill-order-duplicates.ts feat(orders): enhance order handling with email_message_id deduplication and displayContactName utility 2026-08-21 19:18:02 +02:00
_env.ts feat(tv): add TV dashboard + refine workflows 2026-08-13 20:55:22 +02:00
audit-pb-fields.py chore: add logos, opencode config and build assets 2026-07-27 08:21:20 +02:00
backfill-item-intel.ts feat(item-intel): add new item intel popover and backend workflows 2026-08-11 02:57:57 +02:00
backfill-po-items.mjs refactor: switch hardcoded UI colors to semantic theme tokens 2026-07-07 17:22:03 +02:00
build_v5_workflow.py
deploy_v5_to_n8n.py
import-data.ts
mcp-doc-gen.py feat(mcp): enhance API documentation and add new tools 2026-08-15 00:06:40 +02:00
mrbxnim4-telegram-cloud-photo-size-4-6016860144018328845-y.jpg feat(invoicing): add QuickBooks invoicing flow and print functionality 2026-07-09 09:44:55 +02:00
n8n-v2-error.ts
n8n-v2-main.ts
quotes.pb.js refactor: switch hardcoded UI colors to semantic theme tokens 2026-07-07 17:22:03 +02:00
regenerate-delivery-note-pdfs.ts feat: add driverless collection confirm and new order tooling 2026-08-12 01:13:46 +02:00
seed-gielie-quotes.py feat(sprint): add new sprint pricing workflow and supporting code 2026-07-03 07:29:43 +02:00
setup-pocketbase.ts refactor: drop order-level status, shift to item-driven workflow 2026-06-29 13:06:01 +02:00
verify_v5.py