feat(reports): WO box sticker + QR-scan-to-WO endpoint
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/<id>
* 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/<int:wo_id> redirects the
scanner straight to the work-order form
(/odoo/action-mrp.action_mrp_workorder/<id>). 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) <noreply@anthropic.com>
This commit is contained in:
@@ -0,0 +1,5 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
# Copyright 2026 Nexa Systems Inc.
|
||||
# License OPL-1 (Odoo Proprietary License v1.0)
|
||||
|
||||
from . import wo_scan
|
||||
38
fusion_plating/fusion_plating_reports/controllers/wo_scan.py
Normal file
38
fusion_plating/fusion_plating_reports/controllers/wo_scan.py
Normal file
@@ -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/<id> — 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/<int:wo_id>', 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-<xmlid>/<id> 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
|
||||
)
|
||||
Reference in New Issue
Block a user