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) <noreply@anthropic.com>
This commit is contained in:
@@ -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'}
|
||||
|
||||
Reference in New Issue
Block a user