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, + )