# Fusion Plating — Claude Code Instructions ## Project Fusion Plating is a multi-module Odoo 19 ERP for electroless nickel plating and metal finishing shops. Built by Nexa Systems for EN Technologies (the client). Replaces Steelhead Software. ## Module Structure ``` fusion_plating/ — Core: facilities, process types, tanks, baths, chemistry, recipes fusion_plating_shopfloor/ — Tablet UI, plant overview kanban, process tree visualization fusion_plating_portal/ — Customer portal fusion_plating_reports/ — PDF reports (WO margin, discharge sample, etc.) fusion_plating_compliance/ — Compliance framework, jurisdictions fusion_plating_aerospace/ — AS9100 / Nadcap fusion_plating_nuclear/ — CSA N299 / CNSC fusion_plating_cgp/ — Controlled Goods Program fusion_plating_safety/ — SDS, WHMIS, JHSC fusion_plating_quality/ — QMS (NCR, CAPA, calibration) fusion_plating_logistics/ — Pickup & delivery fusion_plating_culture/ — Values / fundamentals fusion_plating_bridge_mrp/ — MRP integration (extends mrp.workorder) fusion_plating_bridge_sign/ — Digital signatures fusion_plating_bridge_quality/ — Quality bridge fusion_plating_process_en/ — Electroless nickel process pack fusion_plating_process_chrome/ — Chrome process pack fusion_plating_process_anodize/ — Anodizing process pack fusion_plating_process_black_oxide/ — Black oxide process pack ``` ## Critical Rules — Odoo 19 1. **NEVER code from memory** — Read reference files from the server first. 2. **Backend OWL**: `static template`, `static props = ["*"]`, standalone `rpc()` from `@web/core/network/rpc`. NOT `useService("rpc")`. 3. **HTTP routes**: `type="jsonrpc"` — NOT `type="json"` (deprecated in Odoo 19). 4. **Search views**: NO `group expand="0"`, NO `string` attribute on ``, NO `` wrapper for group-by filters. 5. **res.config.settings**: Only boolean/integer/float/char/selection/many2one/datetime. NO Date fields. 6. **Field params**: `parent_path` does NOT accept `unaccent` parameter in Odoo 19. 7. **SCSS borders**: Use `$border-color` (SCSS variable) for card borders, NOT `color-mix()` in border shorthand — the SCSS compiler drops it. `color-mix()` works fine in `background-color`, `box-shadow`, etc. 8. **Theme awareness**: All colours must use CSS custom properties (`var(--bs-body-bg)`, `var(--bs-body-color)`, `var(--bs-border-color)`, `var(--bs-secondary-color)`, `var(--o-action)`). NO hardcoded hex. See `fusion_plating_shopfloor.scss` as the gold standard. ## Naming - New fields on **custom models**: standard names (no prefix needed) - New fields on **standard Odoo models**: `x_fc_*` prefix - Legacy fields: `x_studio_*` - Canadian English for all user-facing text - SCSS class prefix: `o_fp_*` (shopfloor: `o_fp_po_*`, `o_fp_pt_*`; recipes: `o_fp_recipe_*`) ## Process Recipe System (NEW — v19.0.2.x) **Model**: `fusion.plating.process.node` (in `fusion_plating` core) - Hierarchical tree with `_parent_store = True` - Node types: `recipe`, `sub_process`, `operation`, `step` - Companion model: `fusion.plating.process.node.input` (operator inputs) - `icon` is a Selection field (24 curated plating icons), NOT a Char - Auto-icon: JS `guessIcon(name)` maps keywords → icons when adding nodes - OWL tree editor: registered as `fp_recipe_tree_editor` client action - Controller: `fusion_plating/controllers/recipe_controller.py` (7 endpoints) - SCSS: `fusion_plating/static/src/scss/recipe_tree_editor.scss` ### Recipe Endpoints ``` POST /fp/recipe/tree — full nested tree for OWL editor POST /fp/recipe/node/create — add child node POST /fp/recipe/node/write — update fields POST /fp/recipe/node/unlink — delete + cascade POST /fp/recipe/node/reorder — bulk sequence update POST /fp/recipe/node/move — change parent_id POST /fp/recipe/duplicate — deep-copy recipe ``` ### Steelhead Features Status | Feature | Status | |---------|--------| | Hierarchical process tree | Done | | Node types (recipe/sub/op/step) | Done | | Auto-complete flag | Done | | Customer visible flag | Done | | Manual/automated flag | Done | | Requires sign-off | Done | | Opt In/Out (disabled/opt-in/opt-out) | Done | | Icon picker | Done | | Time tracking (created/updated with seconds) | Done | | Operator inputs | Done | | Description (rich text) | Done | | File attachments (via mail.thread) | Done | | OWL tree editor with drag-drop | Done | | Tags | Not yet | | Dashboard Transitions | Not yet | | Treatment Groups / Choices | Not yet | | Go To Node Options | Not yet | | Spec Fields | Not yet | ### Client Recipes Created - `ENP-ALUM-BASIC` — Electroless Nickel Plating Aluminium Basic (9 operations, 15 steps). Data file: `fusion_plating/data/fp_recipe_enp_alum_basic.xml` ## Plant Overview Dashboard - OWL client action: `fp_plant_overview` in `fusion_plating_shopfloor` - Kanban columns = work centres, cards = active `mrp.workorder` records - Drag & drop between columns (writes `workcenter_id` on the work order) - Endpoint: `POST /fp/shopfloor/plant_overview` - Move endpoint: `POST /fp/shopfloor/plant_overview/move_card` - Auto-refreshes every 30s ## Deployment ### odoo-entech (LXC 111 on pve-worker5) - **Type**: Native Odoo (apt package, NOT Docker) - **IP**: 10.200.1.26 - **DB**: `admin` (PostgreSQL local, user `odoo`) - **Config**: `/etc/odoo/odoo.conf` - **Addons**: `/mnt/extra-addons/custom/` (fusion_plating modules live here) - **Service**: `systemctl {start|stop|restart} odoo` - **Update command**: ```bash ssh pve-worker5 "pct exec 111 -- bash -c 'systemctl stop odoo && su - odoo -s /bin/bash -c \"/usr/bin/odoo -c /etc/odoo/odoo.conf -d admin -u MODULE_NAME --stop-after-init\" && systemctl start odoo'" ``` - **Copy files**: `cat LOCAL_FILE | ssh pve-worker5 "pct exec 111 -- bash -c 'cat > /mnt/extra-addons/custom/REMOTE_PATH'"` - **IMPORTANT**: Must pass `-c /etc/odoo/odoo.conf` or Odoo won't find the repackaged enterprise addons ### odoo-trial (VM 316 on pve-worker1) - **Type**: Docker (container `odoo-trial-app`, db `odoo-trial-db`) - **DB**: `trial` (user `odoo`) - **Host addons path**: `/opt/odoo/custom-addons/` → mounts as `/mnt/extra-addons/` in Docker - **Docker network**: `odoo_odoo-network` - **Copy files** (base64 pipe through qm guest exec): ```bash B64=$(base64 -w0 "LOCAL_FILE") ssh pve-worker1 "qm guest exec 316 -- bash -c 'echo $B64 | base64 -d > /opt/odoo/custom-addons/REMOTE_PATH'" ``` - **Clear asset cache** (required after SCSS/JS changes): ```bash ssh pve-worker1 "qm guest exec 316 -- bash -c \"docker exec odoo-trial-db psql -U odoo -d trial -c \\\"DELETE FROM ir_attachment WHERE url LIKE '%/web/assets/%';\\\"\"" ``` - **Update command**: ```bash ssh pve-worker1 "qm guest exec 316 -- bash -c 'docker stop odoo-trial-app && docker run --rm --network odoo_odoo-network -v odoo_odoo-data:/var/lib/odoo -v /opt/odoo/custom-addons:/mnt/extra-addons -v /opt/odoo/enterprise-addons:/mnt/enterprise-addons -v /opt/odoo/odoo.conf:/etc/odoo/odoo.conf odoo:19 odoo -d trial -u MODULE_NAME --stop-after-init && docker start odoo-trial-app'" ``` ### Git Push ```bash cd K:/Github/Odoo-Modules/fusion-plating && git push origin main ``` Pushes to both GitHub and Gitea (nexasystems.ca) via multiple remotes. ## Supabase Knowledge Base Project: `nexasystems` (id: `ikvdlqkbqsitabxidvnq`) - `fusionapps.decisions` — past architecture decisions - `fusionapps.issues` — known issues and fixes - `fusionapps.code_snippets` — reference code - `fusionapps.quick_commands` — deployment and admin commands - `fusionapps.vm_registry` — VM inventory - `fusionapps.proxmox_nodes` — cluster node specs ## Custom Workflow (TO BUILD — Next Sessions) End-to-end plating job lifecycle. This is the core business process. ``` 1. Quotation via Configurator └─ sale.order (draft) — configurator picks process type → suggests recipe 2. Quotation Sent └─ sale.order (sent) 3. PO Received from Customer └─ sale.order (confirmed by customer PO) 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 ``` ### What Exists vs What Needs Building | Component | Status | |-----------|--------| | Sale Order / Quotation | Standard Odoo (exists) | | Product Configurator | Needs building or extending | | Recipe assignment to MO | **Not built** — need `x_fc_recipe_id` on `mrp.production` | | Per-job opt-in/out overrides | **Not built** — need `fusion.plating.job.node.override` model + 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) | ### 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? ## Repackaged Enterprise Modules See `K:\Github\RePackaged-Odoo\CLAUDE.md` for full details. Key points: - Odoo 19 enterprise modules repackaged for community edition - All OEEL-1 licenses changed to LGPL-3 - Phone-home/telemetry gutted - `web_enterprise` and `mail_enterprise` are installed on odoo-entech - Addons path includes: `_dependencies`, `accounting`, `inventory_manufacturing`, `hr`, `sales`, `ai`, `fusion_backend`, `custom`, `website`