From 7d8dd8877cc62bbf5a700b48950d2b4b7f01f796 Mon Sep 17 00:00:00 2001 From: Lijo Antony Date: Tue, 26 Jul 2022 16:43:51 +0400 Subject: [PATCH] [FIX] kpi_dashboard: Meter widget supports customization using parameters Meter widget is implemented with GaugeMeter (https://github.com/Mictronics/GaugeMeter). GaugeMeter provides a number of parameters to customize its display. See https://github.com/Mictronics/GaugeMeter#parameter-definitions for details. Allow user to customize GaugeMeter by setting the customization parameters in the result. This mechanism can be used to show actual values instead of percentages by setting total, used & showvalue parameter in the result. Fixes #428 --- kpi_dashboard/README.rst | 17 +++--- kpi_dashboard/__manifest__.py | 2 +- kpi_dashboard/demo/demo_dashboard.xml | 8 +-- kpi_dashboard/readme/CONFIGURE.rst | 2 +- kpi_dashboard/static/description/index.html | 54 ++++++++++--------- .../static/src/js/widget/meter_widget.js | 3 +- 6 files changed, 47 insertions(+), 39 deletions(-) diff --git a/kpi_dashboard/README.rst b/kpi_dashboard/README.rst index 7312871e2..73e56320f 100644 --- a/kpi_dashboard/README.rst +++ b/kpi_dashboard/README.rst @@ -2,10 +2,13 @@ Kpi Dashboard ============= -.. !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! +.. + !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! !! This file is generated by oca-gen-addon-readme !! !! changes will be overwritten. !! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + !! source digest: sha256:3f7c1c23f7a3a6d0be24a8c1fdfd24dbca96ce6215e852d52674f9cf90f6c96f + !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! .. |badge1| image:: https://img.shields.io/badge/maturity-Beta-yellow.png :target: https://odoo-community.org/page/development-status @@ -19,11 +22,11 @@ Kpi Dashboard .. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png :target: https://translation.odoo-community.org/projects/reporting-engine-14-0/reporting-engine-14-0-kpi_dashboard :alt: Translate me on Weblate -.. |badge5| image:: https://img.shields.io/badge/runbot-Try%20me-875A7B.png - :target: https://runbot.odoo-community.org/runbot/143/14.0 - :alt: Try me on Runbot +.. |badge5| image:: https://img.shields.io/badge/runboat-Try%20me-875A7B.png + :target: https://runboat.odoo-community.org/builds?repo=OCA/reporting-engine&target_branch=14.0 + :alt: Try me on Runboat -|badge1| |badge2| |badge3| |badge4| |badge5| +|badge1| |badge2| |badge3| |badge4| |badge5| This module adds new kinds of dashboards on a specific new type of view. @@ -42,7 +45,7 @@ Configure KPIs #. Create a new KPI specifying the computation method and the kpi type #. Number: result must contain a `value` and, if needed, a `previous` - #. Meter: result must contain `value`, `min` and `max` + #. Meter: To show a percentage value, result must contain `value`. `value` must be a positive integer between 0 to 100. Meter is implemented with GaugeMeter (https://github.com/Mictronics/GaugeMeter). It can be customized by setting parameters for GaugeMeter in result. See https://github.com/Mictronics/GaugeMeter#parameter-definitions for details. #. Graph: result must contain a list on `graphs` containing `values`, `title` and `key` #. In order to compute the KPI you can use a predefined function from a model or @@ -74,7 +77,7 @@ Bug Tracker Bugs are tracked on `GitHub Issues `_. In case of trouble, please check there if your issue has already been reported. -If you spotted it first, help us smashing it by providing a detailed and welcomed +If you spotted it first, help us to smash it by providing a detailed and welcomed `feedback `_. Do not contact contributors directly about support or help with technical issues. diff --git a/kpi_dashboard/__manifest__.py b/kpi_dashboard/__manifest__.py index d740c8f2a..b3adf7772 100644 --- a/kpi_dashboard/__manifest__.py +++ b/kpi_dashboard/__manifest__.py @@ -5,7 +5,7 @@ "name": "Kpi Dashboard", "summary": """ Create Dashboards using kpis""", - "version": "14.0.1.2.0", + "version": "14.0.1.2.1", "license": "AGPL-3", "author": "Creu Blanca,Odoo Community Association (OCA)", "website": "https://github.com/OCA/reporting-engine", diff --git a/kpi_dashboard/demo/demo_dashboard.xml b/kpi_dashboard/demo/demo_dashboard.xml index 7b04070a9..c8249bdd8 100644 --- a/kpi_dashboard/demo/demo_dashboard.xml +++ b/kpi_dashboard/demo/demo_dashboard.xml @@ -29,17 +29,19 @@ /> Meter 01 - + % code meter - result = {"min": 0, "max": 100, "value": 90} + result = {"value": 90} Meter 02 $ code meter - result = {"min": 0, "max": 100, "value": 40} + result = {"min": 0, "total": 200, "used": 90, showvalue: True} + - + Kpi Dashboard