# -*- coding: utf-8 -*- # Copyright 2026 Nexa Systems Inc. # License OPL-1 (Odoo Proprietary License v1.0) # # 19.0.10.24.0 — Plant-view Shop Floor kanban redesign. # Backfill fp.job.step.last_activity_at from write_date so existing # in-progress steps don't immediately trip the S16 idle-warning gate # (8 hours since last activity) on first compute after deploy. import logging _logger = logging.getLogger(__name__) def migrate(cr, version): cr.execute(""" UPDATE fp_job_step SET last_activity_at = write_date WHERE last_activity_at IS NULL """) cr.execute("SELECT count(*) FROM fp_job_step WHERE last_activity_at IS NULL") remaining = cr.fetchone()[0] if remaining: _logger.warning( "%d fp.job.step rows still have NULL last_activity_at after " "backfill (no write_date?). These will trip the idle gate " "on first compute.", remaining, ) _logger.info("Backfilled last_activity_at on fp.job.step from write_date")