From e32ff4b056dfd260c2a776474cd4c843305e1fdc Mon Sep 17 00:00:00 2001 From: gsinghpal Date: Thu, 23 Apr 2026 10:52:22 -0400 Subject: [PATCH] feat(reports): MO-bound WO sticker + polished professional layout MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit User reported two issues with the sticker: 1. "Print → WO Box Sticker" didn't appear on the MO form (WH/MO/00067). The operator workflow lives on the MO form, not the WO — binding only to mrp.workorder meant they couldn't see the option. Now bound to BOTH: * mrp.workorder (per-WO sticker) * mrp.production (per-MO sticker — prints the MO friendly name after "WO #" so it reads naturally in shop-floor vocabulary) Internal refactor: factored the layout into a shared inner template report_fp_wo_sticker_inner; the two outer templates normalise their input to the same _order_id / _scan_id / _mo variables and t-call the inner. 2. Design polish. The previous layout was a plain label/value table that looked rough. Redesigned with: * Proper sticker chrome: 0.5mm black border, 1.5mm rounded corners, edge padding. * Header row with bottom border rule separating logo+WO-# on the left from QR+caption on the right. * Grid rows now alternate white / #f4f5f7 zebra-striping with a right-aligned vertical rule between label and value. * ALL-CAPS, letter-spaced, gray-333 labels at 7.5pt; values at 8.5pt with strong (9.5pt, 700) emphasis on the key data (PO, Part Number, Qty) so it reads at a glance from across the warehouse. * Helvetica Neue font stack. * "SCAN TO OPEN" caption under the QR. Scan endpoint updated: /fp/wo/ now tries mrp.production first (operator home form) then falls back to mrp.workorder. Numeric collisions between the two id spaces are possible; MO wins because the MO view carries the full context. fusion_plating_reports → 19.0.7.1.0 Co-Authored-By: Claude Opus 4.7 (1M context) --- .../fusion_plating_reports/__manifest__.py | 2 +- .../controllers/wo_scan.py | 36 +- .../report/report_actions.xml | 16 + .../report/report_fp_wo_sticker.xml | 377 ++++++++++++------ 4 files changed, 286 insertions(+), 145 deletions(-) diff --git a/fusion_plating/fusion_plating_reports/__manifest__.py b/fusion_plating/fusion_plating_reports/__manifest__.py index 6f4538f9..ba93347a 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.7.0.0', + 'version': '19.0.7.1.0', 'category': 'Manufacturing/Plating', 'summary': 'PDF reports for Fusion Plating: quote, SO, WO, packing, BoL, CoC, invoice, receipt, quality + compliance.', 'depends': [ diff --git a/fusion_plating/fusion_plating_reports/controllers/wo_scan.py b/fusion_plating/fusion_plating_reports/controllers/wo_scan.py index b38e8401..424928bd 100644 --- a/fusion_plating/fusion_plating_reports/controllers/wo_scan.py +++ b/fusion_plating/fusion_plating_reports/controllers/wo_scan.py @@ -20,19 +20,27 @@ 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. + """Redirect a scanned sticker to the right backend 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. + Stickers are printed from two sources — mrp.workorder (WO) and + mrp.production (MO) — and both embed their own numeric id in + the QR. Try the MO table first (operators live on the MO + form — customer, SO, all WOs visible) and fall back to WO. """ - 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 - ) + MO = request.env['mrp.production'].sudo() + WO = request.env['mrp.workorder'].sudo() + + mo = MO.browse(wo_id).exists() + if mo: + return request.redirect( + '/odoo/action-mrp.mrp_production_action/%d' % mo.id + ) + + wo = WO.browse(wo_id).exists() + if wo: + return request.redirect( + '/odoo/action-mrp.action_mrp_workorder/%d' % wo.id + ) + + # Neither resolved — land on the WO list so staff can search manually. + return request.redirect('/odoo/manufacturing/work-orders') diff --git a/fusion_plating/fusion_plating_reports/report/report_actions.xml b/fusion_plating/fusion_plating_reports/report/report_actions.xml index e34ef2bc..a3b29aa1 100644 --- a/fusion_plating/fusion_plating_reports/report/report_actions.xml +++ b/fusion_plating/fusion_plating_reports/report/report_actions.xml @@ -348,6 +348,22 @@ + + + WO Box Sticker + mrp.production + qweb-pdf + fusion_plating_reports.report_fp_mo_sticker + fusion_plating_reports.report_fp_mo_sticker + 'WO Sticker - %s' % (object.name or '').replace('/', '-') + + 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 index c5104760..e860c427 100644 --- a/fusion_plating/fusion_plating_reports/report/report_fp_wo_sticker.xml +++ b/fusion_plating/fusion_plating_reports/report/report_fp_wo_sticker.xml @@ -3,145 +3,262 @@ Copyright 2026 Nexa Systems Inc. License OPL-1 (Odoo Proprietary License v1.0) - WO Box Sticker — 4x3" parts-box identification label. + Parts-box identification sticker — printed on a 4x3" label. - Layout mirrors the Steelhead sticker format the client is - migrating from: - * ENTECH logo top-left. - * QR code top-right — encodes the WO's scan URL - (/fp/wo/) so warehouse staff can scan with any - phone/tablet and land on the WO form instantly. - * Grid of PO / Customer / Process / Part Number / Due Date - / Qty / Notes rows. + Bound to BOTH mrp.production (MO) and mrp.workorder (WO) because + the shop talks in "WO #" terms (Steelhead legacy) but the data + hangs off the MO record. The inner template normalises either + input to the same set of resolved variables: + * _order_id — number to print as "WO #" + * _mo — the mrp.production record + * _so, _line — the originating sale order / line + * _part — fp.part.catalog + * _coating — fp.coating.config + * _process — the resolved fusion.plating.process.node tree + * _scan_url — base_url + /fp/wo/ (encoded into the QR) - Printed on a dedicated 4x3" paperformat; no header / footer. + The sticker works identically whether triggered from the MO form + or from any of its child WOs. --> + + + + -
- - - - -
- -
- -
- WO # -
-
- -
- -
-
- - -
-
-
PO (RO):
-
- - () -
-
-
-
Customer:
-
- -
-
-
-
Process:
-
- - - - - - - -
-
-
-
Part Number:
-
- - - Rev - - -
-
-
-
Due Date:
-
- - - - - -
-
-
-
Qty:
-
- -
-
-
-
Notes:
-
- -
-
-
+ +