feat(fusion_plating_shopfloor): /fp/landing/kanban endpoint
Plan task P3.1. New JSON-RPC endpoint for the Shop Floor Landing
client action (Phase 3). Two modes:
station — paired WC + Unassigned + next 1-2 WCs in recipe flow
all_plant — every active WC, recipe-flow order (replaces the data
path for the standalone fp_plant_overview action)
Returns {columns: [{work_center_id, work_center_name, cards}], kpis:
{ready, running, bakes_due, holds}, stations: [...], facility_name,
server_time}. Card payload matches the KanbanCard OWL component
(P1.7) — same shape, no client-side adapter needed.
Light implementation — no urgency scoring or batch prefetch yet.
Both can be ported from plant_overview if performance demands.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -1,2 +1,3 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
from . import test_workspace_controller
|
||||
from . import test_landing_kanban
|
||||
|
||||
@@ -0,0 +1,41 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
# Copyright 2026 Nexa Systems Inc. — License OPL-1
|
||||
"""Plan task P3.1 — /fp/landing/kanban endpoint."""
|
||||
import json
|
||||
|
||||
from odoo.tests.common import HttpCase, tagged
|
||||
|
||||
|
||||
def _rpc(case, url, **params):
|
||||
res = case.url_open(
|
||||
url,
|
||||
data=json.dumps({'jsonrpc': '2.0', 'params': params}),
|
||||
headers={'Content-Type': 'application/json'},
|
||||
)
|
||||
return res.json()['result']
|
||||
|
||||
|
||||
@tagged('-at_install', 'post_install', 'fp_shopfloor')
|
||||
class TestLandingKanban(HttpCase):
|
||||
|
||||
def setUp(self):
|
||||
super().setUp()
|
||||
self.authenticate("admin", "admin")
|
||||
|
||||
def test_all_plant_returns_columns_and_kpis(self):
|
||||
res = _rpc(self, '/fp/landing/kanban', mode='all_plant')
|
||||
self.assertTrue(res['ok'])
|
||||
self.assertEqual(res['mode'], 'all_plant')
|
||||
self.assertIn('columns', res)
|
||||
self.assertIn('kpis', res)
|
||||
for kpi in ('ready', 'running', 'bakes_due', 'holds'):
|
||||
self.assertIn(kpi, res['kpis'])
|
||||
self.assertIn('stations', res)
|
||||
|
||||
def test_station_mode_with_invalid_id_falls_back_to_all_plant_shape(self):
|
||||
# No real station paired → station resolution returns None, but
|
||||
# endpoint still produces a valid columns/kpis payload.
|
||||
res = _rpc(self, '/fp/landing/kanban', mode='station', station_id=999999)
|
||||
self.assertTrue(res['ok'])
|
||||
self.assertIsNone(res['station'])
|
||||
self.assertIn('columns', res)
|
||||
Reference in New Issue
Block a user