fusion_plating_shopfloor: card styling fix + drag & drop between work centres (v19.0.1.1.0)

Cards now have visible borders and elevation shadow in both light/dark
mode. Column count badge restored to high-contrast white-on-gray.

Added HTML5 drag & drop: users can drag work order cards between work
centre columns. Backend endpoint writes workcenter_id on mrp.workorder.
Drop target columns highlight with the action colour.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
gsinghpal
2026-04-12 13:49:47 -04:00
parent a8eacc94bc
commit ccfae66975
4 changed files with 169 additions and 7 deletions

View File

@@ -343,6 +343,46 @@ class FpShopfloorController(http.Controller):
# ==================================================================
# Plant Overview Dashboard
# ==================================================================
@http.route('/fp/shopfloor/plant_overview/move_card',
type='jsonrpc', auth='user')
def plant_overview_move_card(self, card_id, source_model,
target_workcenter_id):
"""Move a work order card to a different work centre (drag & drop).
Only mrp.workorder is supported for now — other source models
will return an error so the frontend can display it gracefully.
"""
if source_model != 'mrp.workorder':
return {'ok': False,
'error': 'Drag & drop is only supported for work orders.'}
MrpWO = request.env.get('mrp.workorder')
if MrpWO is None:
return {'ok': False, 'error': 'MRP module not available.'}
wo = MrpWO.browse(int(card_id))
if not wo.exists():
return {'ok': False, 'error': f'Work order {card_id} not found.'}
wc = request.env['mrp.workcenter'].browse(int(target_workcenter_id))
if not wc.exists():
return {'ok': False,
'error': f'Work centre {target_workcenter_id} not found.'}
try:
wo.write({'workcenter_id': wc.id})
_logger.info(
'Plant Overview: moved WO %s (%s) → WC %s (%s) by uid %s',
wo.id, wo.display_name, wc.id, wc.name,
request.env.uid,
)
except Exception as exc:
_logger.exception('Plant Overview move_card failed')
return {'ok': False, 'error': str(exc)}
return {'ok': True}
@http.route('/fp/shopfloor/plant_overview', type='jsonrpc', auth='user')
def plant_overview(self, facility_id=None, search=None):
"""Return work orders grouped by work centre for the plant overview.