OCA reporting engine fork for dev and update.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

48 lines
1.3 KiB

  1. # Copyright 2020 Creu Blanca
  2. # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
  3. from odoo import models
  4. import random
  5. class KpiKpi(models.Model):
  6. _inherit = "kpi.kpi"
  7. def test_demo_number(self):
  8. return {
  9. "value": random.random() * 10000,
  10. "previous": random.random() * 10000,
  11. }
  12. def test_demo_meter(self):
  13. return {
  14. "min": 0,
  15. "max": 100,
  16. "value": random.random() * 100,
  17. }
  18. def test_demo_graph(self):
  19. return {
  20. "graphs": [
  21. {
  22. "values": [
  23. {"x": i, "y": random.random() * 1000}
  24. for i in range(1, 12)
  25. ],
  26. "title": "Current Year",
  27. "key": "current",
  28. "area": True,
  29. "color": "ffffff",
  30. },
  31. {
  32. "values": [
  33. {"x": i, "y": random.random() * 1000}
  34. for i in range(1, 12)
  35. ],
  36. "title": "Previous Year",
  37. "key": "previous",
  38. "area": True,
  39. "color": "000000",
  40. },
  41. ]
  42. }