From 358bfedae3640f9f1440091dc4d1be2fc16cbbc0 Mon Sep 17 00:00:00 2001 From: Don Kendall Date: Tue, 24 Mar 2026 08:51:19 -0400 Subject: [PATCH] [18.0][FIX] mis_builder: recompute source_aml_model_id after migration source_aml_model_id is a stored computed field introduced in 18.0. After migrating from earlier versions, existing periods have NULL values causing drilldown to fail with "No view found for act_window action undefined". The migration script populates source_aml_model_id from the report's move_lines_source for all periods where it is NULL. Closes OCA/mis-builder#780 Co-Authored-By: Claude Opus 4.6 (1M context) --- mis_builder/__manifest__.py | 2 +- .../migrations/18.0.1.8.2/post-migration.py | 30 +++++++++++++++++++ 2 files changed, 31 insertions(+), 1 deletion(-) create mode 100644 mis_builder/migrations/18.0.1.8.2/post-migration.py diff --git a/mis_builder/__manifest__.py b/mis_builder/__manifest__.py index 1ea8ca89f..987abd997 100644 --- a/mis_builder/__manifest__.py +++ b/mis_builder/__manifest__.py @@ -3,7 +3,7 @@ { "name": "MIS Builder", - "version": "18.0.1.8.1", + "version": "18.0.1.8.2", "category": "Reporting", "summary": """ Build 'Management Information System' Reports and Dashboards diff --git a/mis_builder/migrations/18.0.1.8.2/post-migration.py b/mis_builder/migrations/18.0.1.8.2/post-migration.py new file mode 100644 index 000000000..2e60a9bcb --- /dev/null +++ b/mis_builder/migrations/18.0.1.8.2/post-migration.py @@ -0,0 +1,30 @@ +# Copyright 2026 Ledo Enterprises +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). + +import logging + +_logger = logging.getLogger(__name__) + + +def migrate(cr, version): + """Recompute source_aml_model_id on mis.report.instance.period. + + This stored computed field was introduced in 18.0 but existing periods + from earlier versions have NULL values, causing drilldown to fail with + 'No view found for act_window action undefined'. + """ + cr.execute( + """ + UPDATE mis_report_instance_period p + SET source_aml_model_id = r.move_lines_source + FROM mis_report_instance i + JOIN mis_report r ON r.id = i.report_id + WHERE p.report_instance_id = i.id + AND p.source_aml_model_id IS NULL + AND r.move_lines_source IS NOT NULL + """ + ) + _logger.info( + "Recomputed source_aml_model_id on %d mis.report.instance.period records", + cr.rowcount, + )