diff --git a/fusion-plating/CLAUDE.md b/fusion-plating/CLAUDE.md index f4fcb99c..68359f76 100644 --- a/fusion-plating/CLAUDE.md +++ b/fusion-plating/CLAUDE.md @@ -148,76 +148,124 @@ Project: `nexasystems` (id: `ikvdlqkbqsitabxidvnq`) - `fusionapps.vm_registry` — VM inventory - `fusionapps.proxmox_nodes` — cluster node specs -## Custom Workflow (TO BUILD — Next Sessions) +## End-to-End Business Workflow -End-to-end plating job lifecycle. This is the core business process. +### Full Lifecycle (What Exists Today) ``` -1. Quotation via Configurator - └─ sale.order (draft) — configurator picks process type → suggests recipe +┌─ QUOTATION ──────────────────────────────────────────────────────┐ +│ 1. Customer submits RFQ on portal [DONE] │ +│ → FpQuoteRequest (state: new → under_review → quoted) │ +│ → Model: fusion_plating_portal/models/fp_quote_request.py │ +│ │ +│ 2. Customer accepts → "Create Sale Order" button [DONE] │ +│ → action_create_sale_order() creates SO with lines │ +│ → Links SO origin back to RFQ ref │ +│ │ +│ 3. SO confirmed → MRP creates Manufacturing Order [DONE] │ +│ → Standard Odoo sale_mrp flow │ +└──────────────────────────────────────────────────────────────────┘ -2. Quotation Sent - └─ sale.order (sent) +┌─ MANUFACTURING ──────────────────────────────────────────────────┐ +│ 4. MO confirmed → Portal Job auto-created [DONE] │ +│ → MrpProduction.action_confirm() override │ +│ → Creates FpPortalJob (state: in_progress) │ +│ → Links via x_fc_portal_job_id │ +│ │ +│ 5. Planner assigns recipe + configures steps [DONE] │ +│ → x_fc_recipe_id set on MO │ +│ → Opens fp.recipe.config.wizard for opt-in/out │ +│ → Creates fusion.plating.job.node.override records │ +│ │ +│ 6. Work orders generated from recipe [NOT BUILT] │ +│ → Convert recipe operation nodes → mrp.workorder │ +│ → Respect opt-in/out overrides │ +│ → Map work_center_id, estimated_duration, etc. │ +│ │ +│ 7. Operators execute WOs on shopfloor [DONE] │ +│ → Plant Overview kanban (drag between work centres) │ +│ → Batch chemistry tracking (FpBatch + FpBatchChemistry) │ +│ → Quality holds (FpQualityHold → FpNcr → FpCapa) │ +│ │ +│ 8. MO marked done → Portal job ready_to_ship [DONE] │ +│ → MrpProduction.button_mark_done() override │ +│ → Auto-creates FpDelivery (draft) │ +└──────────────────────────────────────────────────────────────────┘ -3. PO Received from Customer - └─ sale.order (confirmed by customer PO) +┌─ SHIPPING & INVOICING ───────────────────────────────────────────┐ +│ 9. CoC report generated [DONE] │ +│ → report_coc.xml (PDF with job info, certification, sig) │ +│ → Attached to delivery + portal job │ +│ │ +│ 10. Delivery scheduled & executed [DONE] │ +│ → FpDelivery: draft → scheduled → en_route → delivered │ +│ → Chain of custody auto-logged (FpChainOfCustody) │ +│ → Proof of delivery captured (FpProofOfDelivery) │ +│ → Routes with stops (FpRoute + FpRouteStop) │ +│ │ +│ 11. Delivery marked → Portal job shipped [DONE] │ +│ → FpDelivery.action_mark_delivered() override │ +│ → Sets actual_ship_date + tracking_ref on portal job │ +│ │ +│ 12. Account hold check before invoicing [NOT BUILT] │ +│ → Flag on res.partner blocking invoice creation │ +│ → Prevents shipping to customers with overdue balances │ +│ │ +│ 13. Invoice posted → Portal job complete [DONE] │ +│ → AccountMove.action_post() override │ +│ → Sets invoice_ref on portal job, state → complete │ +│ │ +│ 14. Auto-email with CoC + Invoice + Tracking [NOT BUILT] │ +│ → mail.template triggered on delivery/invoice │ +│ → Attaches: CoC PDF, Invoice PDF, tracking info │ +└──────────────────────────────────────────────────────────────────┘ -4. Sale Order Created → triggers MO - └─ sale.order confirmed → mrp.production created - └─ **Recipe assigned to MO** (x_fc_recipe_id on mrp.production) - -5. Two paths: - a. Invoice Directly (simple jobs) - └─ account.move created from SO - b. Work Order Created for Factory + Shipping Label - └─ mrp.workorder records generated from recipe template - └─ **Per-job opt-in/out overrides configured here** - └─ Shipping label created (Fusion Shipping module) - -6. Work Order Completed - └─ mrp.production → done - -7. Invoice Created - └─ account.move — but check for account hold (non-payment flag) - └─ If hold → block invoice until resolved - -8. Product Shipped - └─ stock.picking confirmed - └─ Fusion Shipping module handles carrier integration - -9. Email to Client - └─ Automated email with: - - PDF Certificate of Conformance - - Invoice PDF - - Shipping tracking information +┌─ CUSTOMER PORTAL ────────────────────────────────────────────────┐ +│ 15. Customer sees on portal [DONE] │ +│ → Job progress bar (received → complete) │ +│ → CoC download, invoice access, tracking ref │ +│ → Quote request history │ +└──────────────────────────────────────────────────────────────────┘ ``` -## Per-Job Recipe Overrides (NEW — v19.0.2.0.0 bridge_mrp) -- `x_fc_recipe_id` field on `mrp.production` links MO to a recipe -- `fusion.plating.job.node.override` model stores per-job opt-in/out decisions -- `fp.recipe.config.wizard` — wizard with checklist for planner to toggle optional steps -- "Overrides" stat button on MO form opens the wizard -- Opt-in nodes default unchecked (skipped), opt-out nodes default checked (included) -- Located in `fusion_plating_bridge_mrp` module +### Per-Job Recipe Overrides (v19.0.2.0.0 bridge_mrp) +- `x_fc_recipe_id` on `mrp.production` → links MO to recipe +- `fusion.plating.job.node.override` → per-job opt-in/out decisions +- `fp.recipe.config.wizard` → checklist wizard for planner +- "Overrides" stat button on MO form +- Located in `fusion_plating_bridge_mrp` -### What Exists vs What Needs Building +### 3 Remaining Gaps -| Component | Status | -|-----------|--------| -| Sale Order / Quotation | Standard Odoo (exists) | -| Product Configurator | Needs building or extending | -| Recipe assignment to MO | **Done** — `x_fc_recipe_id` on `mrp.production` | -| Per-job opt-in/out overrides | **Done** — `fusion.plating.job.node.override` + config wizard | -| WO generation from recipe | **Not built** — need to convert recipe nodes → mrp.workorder records | -| Account hold check | Needs investigation (may exist in fusion_plating or accounting) | -| Fusion Shipping integration | Module exists (`fusion_plating_logistics`) — check capabilities | -| Auto-email with Cert+Invoice+Tracking | Needs building (automated action or cron) | +| Gap | Description | Module | +|-----|-------------|--------| +| **Recipe → Work Orders** | Convert recipe operation nodes into mrp.workorder records, respecting opt-in/out overrides. Map work_center_id, estimated_duration. | `fusion_plating_bridge_mrp` | +| **Account Hold Check** | Flag on res.partner that blocks invoice creation / shipping for customers with overdue balances. | `fusion_plating_bridge_mrp` or new module | +| **Auto-Email Package** | On delivery marked shipped (or invoice posted), auto-send email to customer with CoC PDF + Invoice PDF + tracking info. | `fusion_plating_bridge_mrp` | ### Key Architectural Decisions Needed -1. Does the configurator extend Odoo's standard product configurator or is it custom? -2. How do recipe nodes map to mrp.workorder? One node = one WO? Or only operation-level nodes? -3. How does account hold work? Flag on res.partner? On sale.order? -4. What triggers the final email — shipping confirmation? Invoice validation? +1. **Recipe → WO mapping**: One WO per `operation` node? Or one per `step`? (Recommend: one per `operation`, steps become WO instructions) +2. **Account hold**: Flag on `res.partner`? Or computed from `account.move` aging? (Check Steelhead) +3. **Email trigger**: On delivery completion? On invoice posting? Both? (Check with client) +4. **Product Configurator**: Extend standard Odoo or build custom? (Need to see Steelhead's quote flow) + +### Key Models Quick Reference + +| Model | Module | Purpose | +|-------|--------|---------| +| `fusion.plating.process.node` | `fusion_plating` | Recipe tree (template) | +| `fusion.plating.process.node.input` | `fusion_plating` | Operator input definitions | +| `fusion.plating.job.node.override` | `fusion_plating_bridge_mrp` | Per-job opt-in/out | +| `fp.quote.request` | `fusion_plating_portal` | Customer RFQ | +| `fusion.plating.portal.job` | `fusion_plating_portal` | Portal-facing job tracker | +| `fusion.plating.customer.spec` | `fusion_plating_quality` | Spec library | +| `fusion.plating.quality.hold` | `fusion_plating_quality` | Parts on hold | +| `fusion.plating.ncr` | `fusion_plating_quality` | Non-conformance reports | +| `fusion.plating.capa` | `fusion_plating_quality` | Corrective actions | +| `fusion.plating.batch` | `fusion_plating_batch` | Rack/barrel batch tracking | +| `fusion.plating.delivery` | `fusion_plating_logistics` | Delivery with chain of custody | +| `fusion.plating.pickup.request` | `fusion_plating_logistics` | Customer pickup requests | +| `fusion.plating.route` | `fusion_plating_logistics` | Driver routes with stops | ## Repackaged Enterprise Modules See `K:\Github\RePackaged-Odoo\CLAUDE.md` for full details. Key points: