From be33a76ad2874763e27da093b0362915818c9734 Mon Sep 17 00:00:00 2001 From: gsinghpal Date: Thu, 23 Apr 2026 10:39:35 -0400 Subject: [PATCH] feat(reports): WO box sticker + QR-scan-to-WO endpoint MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Client is migrating from Steelhead and needs to keep the small parts-box sticker format the warehouse crew already knows. Two pieces shipped together so scanning is seamless from day one: 1. report_fp_wo_sticker — 4x3" QWeb label bound to mrp.workorder. Layout mirrors the Steelhead sticker: * ENTECH logo top-left (via env.company.logo) * QR code top-right encoding /fp/wo/ * Grid: PO (RO) / Customer / Process / Part Number / Due Date / Qty / Notes Dedicated paperformat_fp_wo_sticker at 102x76mm, 300 DPI, landscape, 3mm margins — sized for thermal / inkjet label printers without shrink-to-fit. Binding added so "Print → WO Box Sticker" appears on every mrp.workorder record. 2. FpWoScanController — GET /fp/wo/ redirects the scanner straight to the work-order form (/odoo/action-mrp.action_mrp_workorder/). auth='user' so logged-in scanners land on the WO immediately; others bounce through Odoo's login and return to the same URL. No custom client work needed — any phone camera, handheld barcode scanner, or tablet browser opens the URL on scan. Process row resolution chain: part.default_process_id → coating.recipe_id → fallback. So the sticker prints whichever process is actually going to drive WO generation for this line, matching the direct-order wizard's Effective Process column. fusion_plating_reports → 19.0.7.0.0 Co-Authored-By: Claude Opus 4.7 (1M context) --- .../fusion_plating_reports/__init__.py | 1 + .../fusion_plating_reports/__manifest__.py | 3 +- .../controllers/__init__.py | 5 + .../controllers/wo_scan.py | 38 +++++ .../report/report_actions.xml | 33 ++++ .../report/report_fp_wo_sticker.xml | 150 ++++++++++++++++++ 6 files changed, 229 insertions(+), 1 deletion(-) create mode 100644 fusion_plating/fusion_plating_reports/controllers/__init__.py create mode 100644 fusion_plating/fusion_plating_reports/controllers/wo_scan.py create mode 100644 fusion_plating/fusion_plating_reports/report/report_fp_wo_sticker.xml diff --git a/fusion_plating/fusion_plating_reports/__init__.py b/fusion_plating/fusion_plating_reports/__init__.py index 140643d0..1a132267 100644 --- a/fusion_plating/fusion_plating_reports/__init__.py +++ b/fusion_plating/fusion_plating_reports/__init__.py @@ -3,3 +3,4 @@ # License OPL-1 (Odoo Proprietary License v1.0) from . import models +from . import controllers diff --git a/fusion_plating/fusion_plating_reports/__manifest__.py b/fusion_plating/fusion_plating_reports/__manifest__.py index 128f548c..6f4538f9 100644 --- a/fusion_plating/fusion_plating_reports/__manifest__.py +++ b/fusion_plating/fusion_plating_reports/__manifest__.py @@ -3,7 +3,7 @@ # License OPL-1 (Odoo Proprietary License v1.0) { 'name': 'Fusion Plating — Reports', - 'version': '19.0.6.0.0', + 'version': '19.0.7.0.0', 'category': 'Manufacturing/Plating', 'summary': 'PDF reports for Fusion Plating: quote, SO, WO, packing, BoL, CoC, invoice, receipt, quality + compliance.', 'depends': [ @@ -42,6 +42,7 @@ 'report/customer_line_header.xml', 'report/report_fp_sale.xml', 'report/report_fp_work_order.xml', + 'report/report_fp_wo_sticker.xml', 'report/report_fp_job_traveller.xml', 'report/report_fp_packing_slip.xml', 'report/report_fp_bol.xml', diff --git a/fusion_plating/fusion_plating_reports/controllers/__init__.py b/fusion_plating/fusion_plating_reports/controllers/__init__.py new file mode 100644 index 00000000..564c861a --- /dev/null +++ b/fusion_plating/fusion_plating_reports/controllers/__init__.py @@ -0,0 +1,5 @@ +# -*- coding: utf-8 -*- +# Copyright 2026 Nexa Systems Inc. +# License OPL-1 (Odoo Proprietary License v1.0) + +from . import wo_scan diff --git a/fusion_plating/fusion_plating_reports/controllers/wo_scan.py b/fusion_plating/fusion_plating_reports/controllers/wo_scan.py new file mode 100644 index 00000000..b38e8401 --- /dev/null +++ b/fusion_plating/fusion_plating_reports/controllers/wo_scan.py @@ -0,0 +1,38 @@ +# -*- coding: utf-8 -*- +# Copyright 2026 Nexa Systems Inc. +# License OPL-1 (Odoo Proprietary License v1.0) +# Part of the Fusion Plating product family. +# +# /fp/wo/ — scan-redirect endpoint. +# +# The WO box sticker embeds a QR code that encodes this URL. When +# warehouse staff scan the sticker with their phone / tablet / +# handheld scanner, the device opens the URL; this controller then +# redirects them to the work-order form inside Odoo's backend. +# Logged-out users land on the standard Odoo login page and bounce +# back after authenticating (Odoo's redirect handles the round-trip). + +from odoo import http +from odoo.http import request + + +class FpWoScanController(http.Controller): + + @http.route('/fp/wo/', type='http', auth='user', website=False) + def wo_scan_redirect(self, wo_id, **kwargs): + """Redirect a scanned WO sticker to the work-order form. + + Uses Odoo 17+/19's action-URL format so the backend opens + directly on the WO's form view. Falls back to a generic + not-found URL if the id doesn't resolve. + """ + wo = request.env['mrp.workorder'].sudo().browse(wo_id).exists() + if not wo: + # Land on the list of all WOs so staff can search manually. + return request.redirect('/odoo/manufacturing/work-orders') + # /odoo/action-/ opens the record's form view. + # Using the vanilla MRP action here so it works regardless of + # whether the user has Plating-specific menus. + return request.redirect( + '/odoo/action-mrp.action_mrp_workorder/%d' % wo.id + ) diff --git a/fusion_plating/fusion_plating_reports/report/report_actions.xml b/fusion_plating/fusion_plating_reports/report/report_actions.xml index 0e8d715e..e34ef2bc 100644 --- a/fusion_plating/fusion_plating_reports/report/report_actions.xml +++ b/fusion_plating/fusion_plating_reports/report/report_actions.xml @@ -315,6 +315,39 @@ + + + + + + + FP WO Sticker (4x3") + custom + 102 + 76 + Landscape + 3 + 3 + 3 + 3 + + 0 + + 300 + + + + WO Box Sticker + mrp.workorder + qweb-pdf + fusion_plating_reports.report_fp_wo_sticker + fusion_plating_reports.report_fp_wo_sticker + 'WO Sticker - %s' % object.name + + report + + + diff --git a/fusion_plating/fusion_plating_reports/report/report_fp_wo_sticker.xml b/fusion_plating/fusion_plating_reports/report/report_fp_wo_sticker.xml new file mode 100644 index 00000000..c5104760 --- /dev/null +++ b/fusion_plating/fusion_plating_reports/report/report_fp_wo_sticker.xml @@ -0,0 +1,150 @@ + + + + + + +