From e4000374cac1f97ff0c57e7193879a30ef6a1646 Mon Sep 17 00:00:00 2001 From: gsinghpal Date: Sat, 23 May 2026 00:37:58 -0400 Subject: [PATCH] feat(fusion_plating_shopfloor): wire tablet_tech_id into workspace endpoints (P6.3.2) hold, sign_off, advance_milestone each accept tablet_tech_id and rebind env via env_for_tablet_tech. Writes (Hold.create, button_finish, action_advance_next_milestone) now carry the tech-of-record's uid. load endpoint is read-only and untouched. Co-Authored-By: Claude Opus 4.7 (1M context) --- .../controllers/workspace_controller.py | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/fusion_plating/fusion_plating_shopfloor/controllers/workspace_controller.py b/fusion_plating/fusion_plating_shopfloor/controllers/workspace_controller.py index cfd8bf7f..899d6810 100644 --- a/fusion_plating/fusion_plating_shopfloor/controllers/workspace_controller.py +++ b/fusion_plating/fusion_plating_shopfloor/controllers/workspace_controller.py @@ -23,6 +23,8 @@ from odoo import fields, http from odoo.addons.fusion_plating.models.fp_tz import fp_format from odoo.http import request +from ._tablet_audit import env_for_tablet_tech + _logger = logging.getLogger(__name__) @@ -190,8 +192,8 @@ class FpWorkspaceController(http.Controller): @http.route('/fp/workspace/hold', type='jsonrpc', auth='user') def hold(self, job_id, reason='other', qty_on_hold=1, description='', part_ref='', step_id=None, mark_for_scrap=False, - photo_data=None, photo_filename=None): - env = request.env + photo_data=None, photo_filename=None, tablet_tech_id=None): + env = env_for_tablet_tech(request.env, tablet_tech_id) job = env['fp.job'].browse(int(job_id)) if not job.exists(): return {'ok': False, 'error': f'Job {job_id} not found'} @@ -253,8 +255,8 @@ class FpWorkspaceController(http.Controller): # /fp/workspace/sign_off — capture signature + finish step atomically # ====================================================================== @http.route('/fp/workspace/sign_off', type='jsonrpc', auth='user') - def sign_off(self, step_id, signature_data_uri): - env = request.env + def sign_off(self, step_id, signature_data_uri, tablet_tech_id=None): + env = env_for_tablet_tech(request.env, tablet_tech_id) sig = (signature_data_uri or '').strip() if not sig: _logger.warning("workspace/sign_off: empty signature for step %s", step_id) @@ -302,8 +304,8 @@ class FpWorkspaceController(http.Controller): # /fp/workspace/advance_milestone — fire next_milestone_action # ====================================================================== @http.route('/fp/workspace/advance_milestone', type='jsonrpc', auth='user') - def advance_milestone(self, job_id): - env = request.env + def advance_milestone(self, job_id, tablet_tech_id=None): + env = env_for_tablet_tech(request.env, tablet_tech_id) job = env['fp.job'].browse(int(job_id)) if not job.exists(): return {'ok': False, 'error': f'Job {job_id} not found'}