def register_all(self, cursor): """ Register all jasper report """ _logger.info('====[REGISTER JASPER REPORT]========================') value = super(IrActionReport, self).register_all(cursor) cursor.execute("SELECT id, report_name FROM ir_act_report_xml WHERE report_type = 'jasper'") records = cursor.dictfetchall() for record in records: registered_report(record['report_name']) _logger.info('====[END REGISTER JASPER REPORT]====================') return value
def register_all(self, cursor): """ Register all jasper report """ _logger.info('====[REGISTER JASPER REPORT]========================') #value = super(IrActionReport, self).register_all(cursor) cursor.execute("SELECT id, report_name FROM ir_act_report_xml WHERE report_type = 'jasper'") records = cursor.dictfetchall() for record in records: registered_report(record['report_name']) _logger.info('====[END REGISTER JASPER REPORT]====================') return True
def make_action(self, cr, uid, id, context=None): """ Create an entry in ir_actions_report_xml and ir.values """ act_report_obj = self.pool.get('ir.actions.report.xml') doc = self.browse(cr, uid, id, context=context) if doc.report_id: _logger.info('Update "%s" service' % doc.name) args = { 'name': doc.name, 'report_name': 'jasper.report_%d' % (doc.id, ), 'model': doc.model_id.model, 'groups_id': [(6, 0, [x.id for x in doc.group_ids])], 'header': False, 'multi': False, } act_report_obj.write(cr, uid, [doc.report_id.id], args, context=context) else: _logger.info('Create "%s" service' % doc.name) args = { 'name': doc.name, 'report_name': 'jasper.report_%d' % (doc.id, ), 'model': doc.model_id.model, 'report_type': 'jasper', 'groups_id': [(6, 0, [x.id for x in doc.group_ids])], 'header': False, 'multi': False, } report_id = act_report_obj.create(cr, uid, args, context=context) cr.execute( """UPDATE jasper_document SET report_id=%s WHERE id=%s""", (report_id, id)) value = 'ir.actions.report.xml,' + str(report_id) self.pool.get('ir.model.data').ir_set(cr, uid, 'action', 'client_print_multi', doc.name, [doc.model_id.model], value, replace=False, isobject=True) registered_report('jasper.report_%d' % (doc.id, ))
def make_action(self, cr, uid, id, context=None): """ Create an entry in ir_actions_report_xml and ir.values """ act_report_obj = self.pool.get('ir.actions.report.xml') doc = self.browse(cr, uid, id, context=context) if doc.report_id: _logger.info('Update "%s" service' % doc.name) args = { 'name': doc.name, 'report_name': 'jasper.report_%d' % (doc.id,), 'model': doc.model_id.model, 'groups_id': [(6, 0, [x.id for x in doc.group_ids])], 'header': False, 'multi': False, } act_report_obj.write(cr, uid, [doc.report_id.id], args, context=context) else: _logger.info('Create "%s" service' % doc.name) args = { 'name': doc.name, 'report_name': 'jasper.report_%d' % (doc.id,), 'model': doc.model_id.model, 'report_type': 'jasper', 'groups_id': [(6, 0, [x.id for x in doc.group_ids])], 'header': False, 'multi': False, } report_id = act_report_obj.create(cr, uid, args, context=context) cr.execute("""UPDATE jasper_document SET report_id=%s WHERE id=%s""", (report_id, id)) value = 'ir.actions.report.xml,' + str(report_id) self.pool.get('ir.model.data').ir_set(cr, uid, 'action', 'client_print_multi', doc.name, [doc.model_id.model], value, replace=False, isobject=True) registered_report('jasper.report_%d' % (doc.id,))