feat(shopfloor): switch action-path RPCs to fpRpc + wire plant_overview/move_card (P6.3.5)

JobWorkspace, ShopfloorLanding, ManagerDashboard, and the embedded
FpHoldComposer now call fpRpc() for write-path endpoints (start/finish
step, hold create, sign-off, milestone advance, work-centre move,
assign-worker, assign-tank, manager takeover). fpRpc auto-injects
tablet_tech_id from the tech_store so the server can rebind env via
env_for_tablet_tech() and credit the right user.

Read-path RPCs (workspace/load, landing/kanban, manager/overview,
manager/funnel, manager/approval_inbox, manager/at_risk, shopfloor/scan)
stay as plain rpc() — no audit benefit, no need for the extra plumbing.

Also wires tablet_tech_id into /fp/shopfloor/plant_overview/move_card
which I missed in P6.3.3 — surfaced when grepping JS for write callers.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
gsinghpal
2026-05-23 00:47:20 -04:00
parent efaf16dffb
commit 5f03080374
5 changed files with 19 additions and 14 deletions

View File

@@ -1108,21 +1108,23 @@ class FpShopfloorController(http.Controller):
@http.route('/fp/shopfloor/plant_overview/move_card',
type='jsonrpc', auth='user')
def plant_overview_move_card(self, card_id, source_model=None,
target_workcenter_id=None):
target_workcenter_id=None,
tablet_tech_id=None):
"""Move a step card to a different work centre (drag & drop).
`source_model` is accepted for backward compatibility but ignored —
Plant Overview now only ever serves fp.job.step cards. A target
of 0 / falsy clears the work centre.
"""
Step = request.env['fp.job.step']
env = env_for_tablet_tech(request.env, tablet_tech_id)
Step = env['fp.job.step']
step = Step.browse(int(card_id))
if not step.exists():
return {'ok': False, 'error': f'Step {card_id} not found.'}
wc_id = int(target_workcenter_id) if target_workcenter_id else False
if wc_id:
wc = request.env['fp.work.centre'].browse(wc_id)
wc = env['fp.work.centre'].browse(wc_id)
if not wc.exists():
return {'ok': False,
'error': f'Work centre {target_workcenter_id} not found.'}
@@ -1132,7 +1134,7 @@ class FpShopfloorController(http.Controller):
_logger.info(
'Plant Overview: moved step %s (%s) → WC %s by uid %s',
step.id, step.name, wc_id or 'unassigned',
request.env.uid,
env.uid,
)
except Exception as exc:
_logger.exception('Plant Overview move_card failed')