Skip to content

[18.0][BUG] Drilldown fails after migration: source_aml_model_id not computed for existing periods #780

@dnplkndll

Description

@dnplkndll

Problem

After migrating from 17.0 to 18.0, clicking any drilldown cell in a MIS report throws:

No view found for act_window action undefined

The drilldown() method returns an action with res_model: False and views: [].

Root cause

source_aml_model_id was introduced in 18.0 as a new stored computed field on mis.report.instance.period:

source_aml_model_id = fields.Many2one(
    ...
    compute="_compute_source_aml_model_id",
    store=True,
    ...
)

On fresh installs, _compute_source_aml_model_id populates this correctly. But after migration from 17.0, existing periods have source_aml_model_id = NULL because:

  1. The field didn't exist in 17.0
  2. The migration script (18.0.1.3.0/post-migration.py) doesn't recompute it
  3. Odoo doesn't automatically recompute stored computed fields for existing records during module upgrade

Since drilldown() reads period.source_aml_model_name (which is related="source_aml_model_id.model"), it gets False, producing an action without res_model.

Fix

Add a recompute step to the migration or a post-init hook:

env["mis.report.instance.period"].search([])._compute_source_aml_model_id()

Or via SQL:

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
  AND p.source IN ('actuals', 'actuals_alt');

Verified

  • Clean install: source_aml_model_id is populated correctly — drilldown works
  • After migration: source_aml_model_id is NULL on all periods — drilldown fails
  • After SQL fix: drilldown works again

Environment

  • Odoo 18.0 CE, migrated from 17.0
  • mis_builder 18.0

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions