def register_report(self, cr, name, model, tmpl_path, parser): name = 'report.%s' % name if netsvc.Service.exists( name): # change for OpenERP 6.0 - Service class usage netsvc.Service.remove( name) # change for OpenERP 6.0 - Service class usage Aeroo_report(cr, name, model, tmpl_path, parser=parser)
def unregister_report(self, cr, name): cr.execute("SELECT * FROM ir_act_report_xml WHERE report_name = %s and active = true ORDER BY id", (name,)) report = cr.dictfetchall() if report: report = report[-1] parser = rml_parse if report['parser_state'] == 'loc' and report['parser_loc']: parser = self.load_from_file(report['parser_loc'], cr.dbname, report['id']) or parser elif report['parser_state'] == 'def' and report['parser_def']: parser = self.load_from_source("from report import report_sxw\n" + report['parser_def']) or parser self.register_report(cr, report['report_name'], report['model'], report['report_rml'], parser) return Aeroo_report(cr, report['report_name'], report['model'], report['report_rml'], parser=parser)
def _lookup_report(self, cr, name): cr.execute( "SELECT * FROM ir_act_report_xml WHERE report_type = 'aeroo' AND report_name = %s AND active='t'", (name, )) records = cr.dictfetchall() for record in records: parser = rml_parse if record['parser_state'] == 'loc' and record['parser_loc']: parser = self.load_from_file(record['parser_loc'], cr.dbname, record['id']) or parser elif record['parser_state'] == 'def' and record['parser_def']: parser = self.load_from_source( "from report import report_sxw\n" + record['parser_def']) or parser return Aeroo_report(cr, "report." + name, record['model'], record['report_rml'], parser) return super(report_xml, self)._lookup_report(cr, name)
def register_report(self, cr, name, model, tmpl_path, parser): name = 'report.%s' % name if netsvc.Service.exists(name): netsvc.Service.remove(name) Aeroo_report(cr, name, model, tmpl_path, parser=parser)
def register_report(self, name, model, tmpl_path, parser): name = 'report.%s' % name if interface.report_int._reports.has_key(name): del interface.report_int._reports[name] res = Aeroo_report(self.env.cr, name, model, tmpl_path, parser=parser) return res