'Look up a report definition.'

@api.model_cr
def _lookup_report(self, name):

    join = os.path.join
    if (('report.' + name) in odoo.report.interface.report_int._reports):
        return odoo.report.interface.report_int._reports[('report.' + name)]
    self._cr.execute('SELECT    *    FROM    ir_act_report_xml    WHERE    report_name=%s', (name,))
    row = self._cr.dictfetchone()
    if (not row):
        raise Exception(('Required    report    does    not    exist:    %s' % name))
    if (row['report_type'] in ('qweb-pdf', 'qweb-html')):
        return row['report_name']
    elif (row['report_rml'] or row['report_rml_content_data']):
        kwargs = {}
        if row['parser']:
            kwargs['parser'] = getattr(odoo.addons, row['parser'])
        return report_sxw(('report.' + row['report_name']), row['model'], join('addons', (row['report_rml'] or '/')), header=row['header'], register=False, **kwargs)
    elif (row['report_xsl'] and row['report_xml']):
        return report_rml(('report.' + row['report_name']), row['model'], join('addons', row['report_xml']), (row['report_xsl'] and join('addons', row['report_xsl'])), register=False)
    else:
        raise Exception(('Unhandled    report    type:    %s' % row))
