diff --git a/report_async/wizard/print_report_wizard.py b/report_async/wizard/print_report_wizard.py index b60c0b95bb..d41b6657fb 100644 --- a/report_async/wizard/print_report_wizard.py +++ b/report_async/wizard/print_report_wizard.py @@ -13,6 +13,7 @@ class PrintReportWizard(models.TransientModel): selection="_reference_models", required=True, ) + reference_model = fields.Char(compute="_compute_reference_model") action_report_id = fields.Many2one( comodel_name="ir.actions.report", string="Report Template", @@ -31,14 +32,18 @@ def _reference_models(self): ) return [(model.model, model.name) for model in models] + @api.depends("reference") + def _compute_reference_model(self): + for record in self: + if record.reference: + record.reference_model = record.reference._name + else: + record.reference_model = False + @api.onchange("reference") def _onchange_reference(self): self.ensure_one() - domain = [("id", "in", [])] self.action_report_id = False - if self.reference: - domain = [("model", "=", self.reference._name)] - return {"domain": {"action_report_id": domain}} def print_report(self): self.ensure_one() diff --git a/report_async/wizard/print_report_wizard.xml b/report_async/wizard/print_report_wizard.xml index 1410e51dad..791d39fd6d 100644 --- a/report_async/wizard/print_report_wizard.xml +++ b/report_async/wizard/print_report_wizard.xml @@ -10,9 +10,11 @@ +