手动新建报表动作和报表视图的注意事项 - xiaohao0576/odoo-doc GitHub Wiki

    def associated_view(self):
        """Used in the ir.actions.report form view in order to search naively after the view(s)
        used in the rendering.
        """
        self.ensure_one()
        action_ref = self.env.ref('base.action_ui_view')
        if not action_ref or len(self.report_name.split('.')) < 2:
            return False
        action_data = action_ref.read()[0]
        action_data['domain'] = [('name', 'ilike', self.report_name.split('.')[1]), ('type', '=', 'qweb')]
        return action_data

代码链接: https://github.com/odoo/odoo/blob/0bbadddcf5a60f9005192dd0ce75ae7c4b11dcec/odoo/addons/base/models/ir_actions_report.py#L215

Snipaste_2025-07-08_12-07-04