mirror of
https://github.com/OCA/reporting-engine.git
synced 2025-02-16 16:30:38 +02:00
[12.0][ADD] kpi_dashboard_test
This commit is contained in:
1
kpi_dashboard_test/models/__init__.py
Normal file
1
kpi_dashboard_test/models/__init__.py
Normal file
@@ -0,0 +1 @@
|
||||
from . import kpi_kpi
|
||||
48
kpi_dashboard_test/models/kpi_kpi.py
Normal file
48
kpi_dashboard_test/models/kpi_kpi.py
Normal file
@@ -0,0 +1,48 @@
|
||||
# Copyright 2020 Creu Blanca
|
||||
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
|
||||
|
||||
from odoo import models
|
||||
import random
|
||||
|
||||
|
||||
class KpiKpi(models.Model):
|
||||
_inherit = "kpi.kpi"
|
||||
|
||||
def test_demo_number(self):
|
||||
return {
|
||||
"value": random.random() * 10000,
|
||||
"previous": random.random() * 10000,
|
||||
}
|
||||
|
||||
def test_demo_meter(self):
|
||||
return {
|
||||
"min": 0,
|
||||
"max": 100,
|
||||
"value": random.random() * 100,
|
||||
}
|
||||
|
||||
def test_demo_graph(self):
|
||||
return {
|
||||
"graphs": [
|
||||
{
|
||||
"values": [
|
||||
{"x": i, "y": random.random() * 1000}
|
||||
for i in range(1, 12)
|
||||
],
|
||||
"title": "Current Year",
|
||||
"key": "current",
|
||||
"area": True,
|
||||
"color": "ffffff",
|
||||
},
|
||||
{
|
||||
"values": [
|
||||
{"x": i, "y": random.random() * 1000}
|
||||
for i in range(1, 12)
|
||||
],
|
||||
"title": "Previous Year",
|
||||
"key": "previous",
|
||||
"area": True,
|
||||
"color": "000000",
|
||||
},
|
||||
]
|
||||
}
|
||||
Reference in New Issue
Block a user