def register_all(self, cursor): value = super(ir_actions_report_xml, self).register_all(cursor) cursor.execute("SELECT * FROM via_form_templates WHERE active = True") records = cursor.dictfetchall() for record in records: _rpt = self.browse(cursor, record.get('create_uid', False), record.get('act_report_id', False)) register_report(_rpt.report_name, _rpt.model, _rpt.report_rml, parser=via_form_template_mako_parser, force_parser=True) return value
def activate(self, cr, uid, ids, context=None): _report_obj = self.pool.get('ir.actions.report.xml') _xml_obj = self.pool.get('ir.model.data') _rpt_vals = { 'report_type': 'webkit', 'auto': False, 'header': False, 'report_file': False, 'report_rml': False, } for _rpt in self.browse(cr, uid, ids, context=context): _vals = _rpt_vals.copy() _vals.update({ 'name': _rpt.name, 'report_name': _rpt.internal_name, 'model': _rpt.model, 'multi': not _rpt.multi, 'webkit_header': _rpt.webkit_header, 'report_webkit_data': _rpt.template, 'webkit_debug': bool(_rpt.report_output == 'html'), }) # Check if the report has old related report, if so, update that if _rpt.old_act_report_id: _rpt.old_act_report_id.write(_vals, context=context) _report_id = _rpt.old_act_report_id.id else: _report_id = _report_obj.create( cr, uid, _vals, context=context) or False if not _report_id: raise osv.except_osv( _('Error'), _("Report Action creation failed for Report %s!") % (_rpt.name)) _rpt.write({ 'active': True, 'act_report_id': _report_id }, context=context) # Register the report _iar = _report_obj.browse(cr, uid, _report_id, context=context) register_report(_iar.report_name, _iar.model, _iar.report_rml, parser=via_form_template_mako_parser, force_parser=True) return True
def activate(self, cr, uid, ids, context=None): _report_obj = self.pool.get('ir.actions.report.xml') _xml_obj = self.pool.get('ir.model.data') _rpt_vals = { 'report_type': 'webkit', 'auto': False, 'header': False, 'report_file': False, 'report_rml': False, } for _rpt in self.browse(cr, uid, ids, context=context): _vals = _rpt_vals.copy() _vals.update({ 'name': _rpt.name, 'report_name': _rpt.internal_name, 'model': _rpt.model, 'multi': not _rpt.multi, 'webkit_header': _rpt.webkit_header, 'report_webkit_data': _rpt.template, 'webkit_debug': bool(_rpt.report_output == 'html'), }) # Check if the report has old related report, if so, update that if _rpt.old_act_report_id: _rpt.old_act_report_id.write(_vals, context=context) _report_id = _rpt.old_act_report_id.id else: _report_id = _report_obj.create(cr, uid, _vals, context=context) or False if not _report_id: raise osv.except_osv(_('Error'), _("Report Action creation failed for Report %s!") % (_rpt.name)) _rpt.write({'active': True, 'act_report_id': _report_id}, context=context) # Register the report _iar = _report_obj.browse(cr, uid, _report_id, context=context) register_report(_iar.report_name, _iar.model, _iar.report_rml, parser=via_form_template_mako_parser, force_parser=True) return True