Public release from ruodoo-project: 19.0 - 2026-05-10 21:19:01 UTC
This commit is contained in:
3
mklab_base_indicators_report/report/__init__.py
Normal file
3
mklab_base_indicators_report/report/__init__.py
Normal file
@ -0,0 +1,3 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
from . import index_report
|
||||
14
mklab_base_indicators_report/report/index_report.py
Normal file
14
mklab_base_indicators_report/report/index_report.py
Normal file
@ -0,0 +1,14 @@
|
||||
from odoo import models, api
|
||||
from odoo.http import Controller, route, request
|
||||
import base64
|
||||
|
||||
class NodeMetricsReportController(Controller):
|
||||
|
||||
@route(['/node_metrics/report/<int:index_id>'], type='http', auth='user')
|
||||
def report(self, index_id):
|
||||
index_record = request.env['hg.index'].sudo().browse(index_id)
|
||||
if not index_record.exists():
|
||||
return "Record not found"
|
||||
image_data = index_record.generate_graph_image()
|
||||
img_html = f'<img src="data:image/png;base64,{image_data}" alt="Node Metrics Graph"/>'
|
||||
return img_html
|
||||
Reference in New Issue
Block a user